Skip to content

Commit c943b7e

Browse files
committed
changes according to code review
1 parent fc41a9b commit c943b7e

16 files changed

Lines changed: 78 additions & 84 deletions

File tree

accesscontrol/casbin_rbac_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ import (
1616
// in-memory by casbin's model layer; this adapter only satisfies the interface.
1717
type noopAdapter struct{}
1818

19-
func (noopAdapter) LoadPolicy(_ casbinModel.Model) error { return nil }
20-
func (noopAdapter) SavePolicy(_ casbinModel.Model) error { return nil }
21-
func (noopAdapter) AddPolicy(_, _ string, _ []string) error { return nil }
22-
func (noopAdapter) RemovePolicy(_, _ string, _ []string) error { return nil }
23-
func (noopAdapter) RemoveFilteredPolicy(_, _ string, _ int, _ ...string) error { return nil }
24-
func (noopAdapter) LoadPolicyCtx(_ context.Context, _ casbinModel.Model) error { return nil }
25-
func (noopAdapter) SavePolicyCtx(_ context.Context, _ casbinModel.Model) error { return nil }
26-
func (noopAdapter) AddPolicyCtx(_ context.Context, _, _ string, _ []string) error { return nil }
19+
func (noopAdapter) LoadPolicy(_ casbinModel.Model) error { return nil }
20+
func (noopAdapter) SavePolicy(_ casbinModel.Model) error { return nil }
21+
func (noopAdapter) AddPolicy(_, _ string, _ []string) error { return nil }
22+
func (noopAdapter) RemovePolicy(_, _ string, _ []string) error { return nil }
23+
func (noopAdapter) RemoveFilteredPolicy(_, _ string, _ int, _ ...string) error { return nil }
24+
func (noopAdapter) LoadPolicyCtx(_ context.Context, _ casbinModel.Model) error { return nil }
25+
func (noopAdapter) SavePolicyCtx(_ context.Context, _ casbinModel.Model) error { return nil }
26+
func (noopAdapter) AddPolicyCtx(_ context.Context, _, _ string, _ []string) error { return nil }
2727
func (noopAdapter) RemovePolicyCtx(_ context.Context, _, _ string, _ []string) error { return nil }
2828
func (noopAdapter) RemoveFilteredPolicyCtx(_ context.Context, _, _ string, _ int, _ ...string) error {
2929
return nil

accesscontrol/members.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@
1414
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1515

1616
package accesscontrol
17-

cmd/devguard-scanner/commands/sign.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func signCmd(cmd *cobra.Command, args []string) error {
8282
&cosignoptions.RootOptions{},
8383
ko,
8484
fileOrImageName,
85-
false, // b64
85+
false, // b64
8686
"", "", // outputSignature, outputCertificate
8787
false, // tlogUpload
8888
)

controllers/asset_controller.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ import (
1919
)
2020

2121
type AssetController struct {
22-
assetRepository shared.AssetRepository
23-
assetVersionRepository shared.AssetVersionRepository
22+
assetRepository shared.AssetRepository
23+
assetVersionRepository shared.AssetVersionRepository
2424
artifactRiskHistoryRepository shared.ArtifactRiskHistoryRepository
25-
assetService shared.AssetService
26-
dependencyVulnService shared.DependencyVulnService
27-
statisticsService shared.StatisticsService
28-
thirdPartyIntegration shared.IntegrationAggregate
29-
daemonRunner shared.DaemonRunner
25+
assetService shared.AssetService
26+
dependencyVulnService shared.DependencyVulnService
27+
statisticsService shared.StatisticsService
28+
thirdPartyIntegration shared.IntegrationAggregate
29+
daemonRunner shared.DaemonRunner
3030

3131
utils.FireAndForgetSynchronizer
3232
}
@@ -476,7 +476,7 @@ func (a *AssetController) GetBadges(ctx shared.Context) error {
476476
}
477477
var artifactName *string
478478
artifact, err := shared.MaybeGetArtifact(ctx)
479-
if err == nil && artifact != nil {
479+
if err == nil {
480480
artifactName = &artifact.ArtifactName
481481
}
482482

controllers/dependencyfirewall/oci.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"net/http"
2626
"net/url"
2727
"os"
28-
2928
"regexp"
3029
"strings"
3130
"time"

controllers/helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func ctxToBOMMetadata(ctx shared.Context) normalize.BOMMetadata {
2828
assetVersion := shared.GetAssetVersion(ctx)
2929
artifactName := ""
3030
artifact, err := shared.MaybeGetArtifact(ctx)
31-
if err != nil || artifact == nil {
31+
if err != nil {
3232
org := shared.GetOrg(ctx)
3333
project := shared.GetProject(ctx)
3434

database/models/component_model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (c ComponentDependencyNode) GetID() string {
9393
func (c ComponentDependency) ToNodes() []ComponentDependencyNode {
9494
// a component dependency represents an edge in the dependency tree
9595
// thus we can represent it as two nodes
96-
return []ComponentDependencyNode{ComponentDependencyNode{ID: utils.SafeDereference(c.ComponentID)}, ComponentDependencyNode{ID: c.DependencyID}}
96+
return []ComponentDependencyNode{{ID: utils.SafeDereference(c.ComponentID)}, {ID: c.DependencyID}}
9797
}
9898

9999
func resolveLicense(component ComponentDependency, componentLicenseOverwrites map[string]string) cyclonedx.Licenses {

database/repositories/gitlab_integration_repository.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ func (r *gitlabOauth2TokenRepository) CreateIfNotExists(ctx context.Context, tx
112112
return r.GetDB(ctx, tx).Clauses(clause.OnConflict{
113113
DoNothing: true,
114114
Columns: []clause.Column{
115-
clause.Column{
115+
{
116116
Name: "provider_id",
117117
},
118-
clause.Column{
118+
{
119119
Name: "user_id",
120120
},
121121
},

database/repositories/malicious_package_repository.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import (
2424
)
2525

2626
type MaliciousPackageRepository struct {
27-
db *gorm.DB
28-
pkgRepo *GormRepository[string, models.MaliciousPackage]
29-
compRepo *GormRepository[string, models.MaliciousAffectedComponent]
27+
db *gorm.DB
28+
pkgRepo *GormRepository[string, models.MaliciousPackage]
29+
compRepo *GormRepository[string, models.MaliciousAffectedComponent]
3030
}
3131

3232
func NewMaliciousPackageRepository(db *gorm.DB) *MaliciousPackageRepository {
@@ -67,4 +67,3 @@ func (r *MaliciousPackageRepository) GetMaliciousPackageByID(ctx context.Context
6767
err := r.GetDB(ctx, tx).Where("id = ?", id).First(&maliciousPackage).Error
6868
return maliciousPackage, err
6969
}
70-

fixedversion/vulnerability_path_analysis_fixed_version_resolver_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ func TestEnsureDirectDependencyFixedVersionPURL(t *testing.T) {
6868
})
6969
}
7070

71-
7271
func TestBuildFullPackageName(t *testing.T) {
7372
tests := []struct {
7473
name string

0 commit comments

Comments
 (0)