From 3ab459e3b674f319bf349d478917a531a69754c0 Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Mon, 5 May 2025 07:50:37 +0200 Subject: [PATCH] fix: more revive rules (#8814) Signed-off-by: Matthieu MOREL --- .golangci.yaml | 12 +++ cmd/trivy/main.go | 5 +- go.mod | 77 +++++++++---------- magefiles/fixture.go | 10 +-- magefiles/magefile.go | 10 +-- pkg/dependency/parser/nodejs/pnpm/parse.go | 1 - pkg/fanal/secret/scanner.go | 4 +- pkg/flag/options.go | 6 +- .../azure/arm/parser/armjson/unmarshal.go | 10 +-- .../cloudformation/parser/property.go | 5 +- pkg/iac/scanners/helm/scanner.go | 6 +- pkg/parallel/pipeline.go | 5 +- pkg/parallel/walk.go | 5 +- pkg/report/table/licensing.go | 4 - pkg/report/table/misconfig.go | 2 - pkg/report/table/secret.go | 2 - pkg/report/table/summary.go | 2 - pkg/report/table/vulnerability.go | 2 - 18 files changed, 65 insertions(+), 103 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 09835e5c8e..25bb2eb80f 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -91,16 +91,28 @@ linters: max-open-files: 2048 # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md rules: + - name: bool-literal-in-expr + - name: context-as-argument + arguments: + - allowTypesBefore: "*testing.T" + - name: duplicated-imports - name: early-return arguments: - preserve-scope + - name: if-return + - name: increment-decrement - name: indent-error-flow arguments: - preserve-scope + - name: range + - name: range-val-address - name: superfluous-else arguments: - preserve-scope + - name: time-equal + - name: unnecessary-stmt - name: unused-parameter + - name: use-any testifylint: enable-all: true diff --git a/cmd/trivy/main.go b/cmd/trivy/main.go index 84d8879fbd..80d7ab8f71 100644 --- a/cmd/trivy/main.go +++ b/cmd/trivy/main.go @@ -42,8 +42,5 @@ func run() error { } app := commands.NewApp() - if err := app.Execute(); err != nil { - return err - } - return nil + return app.Execute() } diff --git a/go.mod b/go.mod index 7316078a49..cf96d77b77 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,6 @@ require ( github.com/aquasecurity/go-pep440-version v0.0.1 github.com/aquasecurity/go-version v0.0.1 github.com/aquasecurity/iamgo v0.0.10 - github.com/aquasecurity/jfather v0.0.8 // indirect github.com/aquasecurity/table v1.8.0 github.com/aquasecurity/testdocker v0.0.0-20240730042311-4642e94c7fc8 github.com/aquasecurity/tml v0.6.1 @@ -49,8 +48,6 @@ require ( github.com/fatih/color v1.18.0 github.com/go-git/go-git/v5 v5.15.0 github.com/go-json-experiment/json v0.0.0-20250223041408-d3c622f1b874 // Replace with encoding/json/v2 when proposal is accepted. Track https://github.com/golang/go/issues/71497 - github.com/go-openapi/runtime v0.28.0 // indirect - github.com/go-openapi/strfmt v0.23.0 // indirect github.com/go-redis/redis/v8 v8.11.5 github.com/gocsaf/csaf/v3 v3.2.0 github.com/golang-jwt/jwt/v5 v5.2.2 @@ -94,7 +91,6 @@ require ( github.com/openvex/discovery v0.1.1-0.20240802171711-7c54efc57553 github.com/openvex/go-vex v0.2.5 github.com/owenrumney/go-sarif/v2 v2.3.3 - github.com/owenrumney/squealer v1.2.11 // indirect github.com/package-url/packageurl-go v0.1.3 github.com/quasilyte/go-ruleguard/dsl v0.3.22 github.com/rust-secure-code/go-rustaudit v0.0.0-20250226111315-e20ec32e963c @@ -120,7 +116,6 @@ require ( github.com/zclconf/go-cty-yaml v1.1.0 go.etcd.io/bbolt v1.4.0 golang.org/x/crypto v0.37.0 - golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect golang.org/x/mod v0.24.0 golang.org/x/net v0.39.0 golang.org/x/sync v0.13.0 @@ -134,7 +129,6 @@ require ( k8s.io/api v0.33.0 k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 modernc.org/sqlite v1.37.0 - sigs.k8s.io/yaml v1.4.0 // indirect ) require ( @@ -174,10 +168,23 @@ require ( github.com/VividCortex/ewma v1.2.0 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/agnivade/levenshtein v1.2.1 // indirect + github.com/alessio/shellescape v1.4.1 // indirect github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302 // indirect github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect + github.com/aquasecurity/jfather v0.0.8 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect + github.com/aws/aws-sdk-go v1.55.7 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.34 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.34 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect + github.com/aws/aws-sdk-go-v2/service/ebs v1.22.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.25.3 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.1 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.33.19 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/blang/semver v3.5.1+incompatible // indirect @@ -214,10 +221,13 @@ require ( github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 // indirect github.com/dustin/go-humanize v1.0.1 // indirect + github.com/ebitengine/purego v0.8.2 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/emirpasic/gods v1.18.1 // indirect + github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect github.com/evanphx/json-patch v5.9.0+incompatible // indirect + github.com/evanphx/json-patch/v5 v5.6.0 // indirect github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.8.0 // indirect @@ -237,9 +247,12 @@ require ( github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.21.0 // indirect github.com/go-openapi/loads v0.22.0 // indirect + github.com/go-openapi/runtime v0.28.0 // indirect github.com/go-openapi/spec v0.21.0 // indirect + github.com/go-openapi/strfmt v0.23.0 // indirect github.com/go-openapi/swag v0.23.1 // indirect github.com/go-openapi/validate v0.24.0 // indirect + github.com/go-viper/mapstructure/v2 v2.2.1 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/goccy/go-yaml v1.15.23 // indirect github.com/gofrs/uuid v4.3.1+incompatible // indirect @@ -251,9 +264,12 @@ require ( github.com/google/certificate-transparency-go v1.1.8 // indirect github.com/google/gnostic-models v0.6.9 // indirect github.com/google/go-cmp v0.7.0 // indirect + github.com/google/go-github/v31 v31.0.0 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/s2a-go v0.1.9 // indirect + github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect + github.com/google/subcommands v1.2.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect github.com/googleapis/gax-go/v2 v2.14.1 // indirect github.com/gorilla/mux v1.8.1 // indirect @@ -275,6 +291,7 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/klauspost/compress v1.18.0 // indirect + github.com/knqyf263/labeler v0.0.0-20200423181506-7a6e545148c3 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect github.com/letsencrypt/boulder v0.0.0-20240620165639-de9c06129bec // indirect @@ -292,9 +309,11 @@ require ( github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect + github.com/moby/go-archive v0.1.0 // indirect github.com/moby/locker v1.0.1 // indirect github.com/moby/patternmatcher v0.6.0 // indirect github.com/moby/spdystream v0.5.0 // indirect + github.com/moby/sys/atomicwriter v0.1.0 // indirect github.com/moby/sys/mountinfo v0.7.2 // indirect github.com/moby/sys/sequential v0.6.0 // indirect github.com/moby/sys/signal v0.7.1 // indirect @@ -310,9 +329,12 @@ require ( github.com/ncruces/go-strftime v0.1.9 // indirect github.com/nozzle/throttler v0.0.0-20180817012639-2ea982251481 // indirect github.com/oklog/ulid v1.3.1 // indirect + github.com/oklog/ulid/v2 v2.1.0 // indirect github.com/opencontainers/runtime-spec v1.2.0 // indirect github.com/opencontainers/selinux v1.11.1 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect + github.com/owenrumney/squealer v1.2.11 // indirect + github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/pjbgf/sha1cd v0.3.2 // indirect @@ -331,12 +353,15 @@ require ( github.com/rubenv/sql-migrate v1.7.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sagikazarmark/locafero v0.7.0 // indirect + github.com/samber/oops v1.15.0 // indirect github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect github.com/sassoftware/relic v7.2.1+incompatible // indirect github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect github.com/shibumi/go-pathspec v1.3.0 // indirect + github.com/shirou/gopsutil/v4 v4.25.1 // indirect github.com/shopspring/decimal v1.4.0 // indirect github.com/sigstore/cosign/v2 v2.2.4 // indirect + github.com/sigstore/protobuf-specs v0.4.1 // indirect github.com/sigstore/sigstore v1.9.1 // indirect github.com/sigstore/timestamp-authority v1.2.2 // indirect github.com/skeema/knownhosts v1.3.1 // indirect @@ -350,6 +375,7 @@ require ( github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 // indirect github.com/tklauser/go-sysconf v0.3.13 // indirect github.com/tklauser/numcpus v0.7.0 // indirect + github.com/tonglil/versioning v0.0.0-20170205083536-8b2a4334bd1d // indirect github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4 // indirect github.com/transparency-dev/merkle v0.0.2 // indirect github.com/ulikunitz/xz v0.5.12 // indirect @@ -377,6 +403,7 @@ require ( go.opentelemetry.io/otel/trace v1.35.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect + golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect golang.org/x/oauth2 v0.28.0 // indirect golang.org/x/sys v0.32.0 // indirect golang.org/x/telemetry v0.0.0-20240522233618-39ace7a40ae7 // indirect @@ -391,6 +418,7 @@ require ( gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect k8s.io/apiextensions-apiserver v0.32.2 // indirect k8s.io/apimachinery v0.33.0 // indirect k8s.io/apiserver v0.32.2 // indirect @@ -406,43 +434,12 @@ require ( mvdan.cc/sh/v3 v3.11.0 // indirect oras.land/oras-go v1.2.5 // indirect sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect + sigs.k8s.io/kind v0.19.0 // indirect sigs.k8s.io/kustomize/api v0.19.0 // indirect sigs.k8s.io/kustomize/kyaml v0.19.0 // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect -) - -require ( - github.com/alessio/shellescape v1.4.1 // indirect - github.com/aws/aws-sdk-go v1.55.7 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.34 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.34 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect - github.com/aws/aws-sdk-go-v2/service/ebs v1.22.1 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.25.3 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.33.19 // indirect - github.com/ebitengine/purego v0.8.2 // indirect - github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect - github.com/evanphx/json-patch/v5 v5.6.0 // indirect - github.com/go-viper/mapstructure/v2 v2.2.1 // indirect - github.com/google/go-github/v31 v31.0.0 // indirect - github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 // indirect - github.com/google/subcommands v1.2.0 // indirect - github.com/knqyf263/labeler v0.0.0-20200423181506-7a6e545148c3 // indirect - github.com/moby/go-archive v0.1.0 // indirect - github.com/moby/sys/atomicwriter v0.1.0 // indirect - github.com/oklog/ulid/v2 v2.1.0 // indirect - github.com/pelletier/go-toml v1.9.5 // indirect - github.com/samber/oops v1.15.0 // indirect - github.com/shirou/gopsutil/v4 v4.25.1 // indirect - github.com/sigstore/protobuf-specs v0.4.1 // indirect - github.com/tonglil/versioning v0.0.0-20170205083536-8b2a4334bd1d // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect - sigs.k8s.io/kind v0.19.0 // indirect sigs.k8s.io/randfill v1.0.0 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) tool ( diff --git a/magefiles/fixture.go b/magefiles/fixture.go index 39e5bd0dda..83eca420e3 100644 --- a/magefiles/fixture.go +++ b/magefiles/fixture.go @@ -38,10 +38,7 @@ func fixtureContainerImages() error { } // Save trivy-test-images/containerd image - if err := saveImage("containerd", "latest"); err != nil { - return err - } - return nil + return saveImage("containerd", "latest") } func saveImage(subpath, tag string) error { @@ -65,10 +62,7 @@ func saveImage(subpath, tag string) error { if err = crane.Save(img, imgName, tarPath); err != nil { return err } - if err = sh.Run("gzip", tarPath); err != nil { - return err - } - return nil + return sh.Run("gzip", tarPath) } func fixtureVMImages() error { diff --git a/magefiles/magefile.go b/magefiles/magefile.go index eea8abd8e2..8dafe81e67 100644 --- a/magefiles/magefile.go +++ b/magefiles/magefile.go @@ -189,19 +189,13 @@ func (Test) FixtureTerraformPlanSnapshots() error { // GenerateModules compiles WASM modules for unit tests func (Test) GenerateModules() error { pattern := filepath.Join("pkg", "module", "testdata", "*", "*.go") - if err := compileWasmModules(pattern); err != nil { - return err - } - return nil + return compileWasmModules(pattern) } // GenerateExampleModules compiles example Wasm modules for integration tests func (Test) GenerateExampleModules() error { pattern := filepath.Join("examples", "module", "*", "*.go") - if err := compileWasmModules(pattern); err != nil { - return err - } - return nil + return compileWasmModules(pattern) } // UpdateGolden updates golden files for integration tests diff --git a/pkg/dependency/parser/nodejs/pnpm/parse.go b/pkg/dependency/parser/nodejs/pnpm/parse.go index 2e9d3f31d2..efad36c52a 100644 --- a/pkg/dependency/parser/nodejs/pnpm/parse.go +++ b/pkg/dependency/parser/nodejs/pnpm/parse.go @@ -245,7 +245,6 @@ func (p *Parser) markRootPkgs(id string, pkgs map[string]ftypes.Package, deps ma for _, depID := range deps[id].DependsOn { p.markRootPkgs(depID, pkgs, deps, visited) } - return } func (p *Parser) parseLockfileVersion(lockFile LockFile) float64 { diff --git a/pkg/fanal/secret/scanner.go b/pkg/fanal/secret/scanner.go index 01283ea42a..b1c62dfea2 100644 --- a/pkg/fanal/secret/scanner.go +++ b/pkg/fanal/secret/scanner.go @@ -175,7 +175,7 @@ func (r *Rule) MatchKeywords(content []byte) bool { if len(r.Keywords) == 0 { return true } - var contentLower = bytes.ToLower(content) + contentLower := bytes.ToLower(content) for _, kw := range r.Keywords { if bytes.Contains(contentLower, []byte(strings.ToLower(kw))) { return true @@ -499,7 +499,7 @@ func findLocation(start, end int, content []byte) (int, int, types.Code, string) if lineStart == -1 { lineStart = 0 } else { - lineStart += 1 + lineStart++ } lineEnd := bytes.Index(content[start:], lineSep) diff --git a/pkg/flag/options.go b/pkg/flag/options.go index d31ee43a5e..f0f8276a56 100644 --- a/pkg/flag/options.go +++ b/pkg/flag/options.go @@ -312,11 +312,7 @@ func (f *Flag[T]) Bind(cmd *cobra.Command) error { } // Bind environmental variable - if err := f.BindEnv(); err != nil { - return err - } - - return nil + return f.BindEnv() } func (f *Flag[T]) BindEnv() error { diff --git a/pkg/iac/scanners/azure/arm/parser/armjson/unmarshal.go b/pkg/iac/scanners/azure/arm/parser/armjson/unmarshal.go index b198bb7b70..d077dc99a3 100644 --- a/pkg/iac/scanners/azure/arm/parser/armjson/unmarshal.go +++ b/pkg/iac/scanners/azure/arm/parser/armjson/unmarshal.go @@ -20,11 +20,8 @@ func Unmarshal(data []byte, target any, metadata *types.Metadata) error { if err != nil { return err } - if err := node.Decode(target); err != nil { - return err - } - return nil + return node.Decode(target) } func UnmarshalFromReader(r io.ReadSeeker, target any, metadata *types.Metadata) error { @@ -32,9 +29,6 @@ func UnmarshalFromReader(r io.ReadSeeker, target any, metadata *types.Metadata) if err != nil { return err } - if err := node.Decode(target); err != nil { - return err - } - return nil + return node.Decode(target) } diff --git a/pkg/iac/scanners/cloudformation/parser/property.go b/pkg/iac/scanners/cloudformation/parser/property.go index edc0fed532..c05e443dac 100644 --- a/pkg/iac/scanners/cloudformation/parser/property.go +++ b/pkg/iac/scanners/cloudformation/parser/property.go @@ -96,10 +96,7 @@ func (p *Property) UnmarshalYAML(node *yaml.Node) error { p.StartLine = node.Line p.EndLine = calculateEndLine(node) p.comment = node.LineComment - if err := setPropertyValueFromYaml(node, p); err != nil { - return err - } - return nil + return setPropertyValueFromYaml(node, p) } func (p *Property) UnmarshalJSONFrom(dec *jsontext.Decoder) error { diff --git a/pkg/iac/scanners/helm/scanner.go b/pkg/iac/scanners/helm/scanner.go index f8f6c1ae89..fc6173d980 100644 --- a/pkg/iac/scanners/helm/scanner.go +++ b/pkg/iac/scanners/helm/scanner.go @@ -74,13 +74,13 @@ func (s *Scanner) ScanFS(ctx context.Context, fsys fs.FS, dir string) (scan.Resu } if detection.IsArchive(filePath) { - scanResults, err := s.getScanResults(filePath, ctx, fsys) + scanResults, err := s.getScanResults(ctx, filePath, fsys) if err != nil { return err } results = append(results, scanResults...) } else if path.Base(filePath) == chartutil.ChartfileName { - if scanResults, err := s.getScanResults(filepath.Dir(filePath), ctx, fsys); err != nil { + if scanResults, err := s.getScanResults(ctx, filepath.Dir(filePath), fsys); err != nil { return err } else { results = append(results, scanResults...) @@ -97,7 +97,7 @@ func (s *Scanner) ScanFS(ctx context.Context, fsys fs.FS, dir string) (scan.Resu } -func (s *Scanner) getScanResults(path string, ctx context.Context, target fs.FS) (results []scan.Result, err error) { +func (s *Scanner) getScanResults(ctx context.Context, path string, target fs.FS) (results []scan.Result, err error) { helmParser, err := parser.New(path, s.parserOptions...) if err != nil { return nil, err diff --git a/pkg/parallel/pipeline.go b/pkg/parallel/pipeline.go index 7dbc70f3e1..75530c9e7e 100644 --- a/pkg/parallel/pipeline.go +++ b/pkg/parallel/pipeline.go @@ -108,8 +108,5 @@ func (p *Pipeline[T, U]) Do(ctx context.Context) error { // Check whether any of the goroutines failed. Since g is accumulating the // errors, we don't need to send them (or check for them) in the individual // results sent on the channel. - if err := g.Wait(); err != nil { - return err - } - return nil + return g.Wait() } diff --git a/pkg/parallel/walk.go b/pkg/parallel/walk.go index be569e5bc0..3fe65c40ad 100644 --- a/pkg/parallel/walk.go +++ b/pkg/parallel/walk.go @@ -81,10 +81,7 @@ func WalkDir[T any](ctx context.Context, fsys fs.FS, root string, parallel int, // Check whether any of the goroutines failed. Since g is accumulating the // errors, we don't need to send them (or check for them) in the individual // results sent on the channel. - if err := g.Wait(); err != nil { - return err - } - return nil + return g.Wait() } func walk[T any](ctx context.Context, fsys fs.FS, path string, c chan T, onFile onFile[T]) error { diff --git a/pkg/report/table/licensing.go b/pkg/report/table/licensing.go index be9ca32381..6c6e957868 100644 --- a/pkg/report/table/licensing.go +++ b/pkg/report/table/licensing.go @@ -52,8 +52,6 @@ func (r *pkgLicenseRenderer) Render(result types.Result) { r.printf("Total: %d (%s)\n\n", total, strings.Join(summaries, ", ")) r.tableWriter.Render() - - return } func (r *pkgLicenseRenderer) setHeaders() { @@ -136,8 +134,6 @@ func (r *fileLicenseRenderer) Render(result types.Result) { r.printf("Total: %d (%s)\n\n", total, strings.Join(summaries, ", ")) r.tableWriter.Render() - - return } func (r *fileLicenseRenderer) setHeaders() { diff --git a/pkg/report/table/misconfig.go b/pkg/report/table/misconfig.go index 025f184d46..8ca2e88cbc 100644 --- a/pkg/report/table/misconfig.go +++ b/pkg/report/table/misconfig.go @@ -77,7 +77,6 @@ func (r *misconfigRenderer) Render(result types.Result) { if r.trace { r.outputTrace(result.Target, result.Misconfigurations) } - return } func (r *misconfigRenderer) countSeverities(misconfigs []types.DetectedMisconfiguration) map[string]int { @@ -116,7 +115,6 @@ func (r *misconfigRenderer) renderSingle(target string, typ ftypes.TargetType, m } func (r *misconfigRenderer) renderSummary(misconf types.DetectedMisconfiguration) { - // show pass/fail/exception unless we are only showing failures if r.includeNonFailures { switch misconf.Status { diff --git a/pkg/report/table/secret.go b/pkg/report/table/secret.go index 2ef556fe70..bf5401c29c 100644 --- a/pkg/report/table/secret.go +++ b/pkg/report/table/secret.go @@ -53,7 +53,6 @@ func (r *secretRenderer) Render(result types.Result) { for _, m := range result.Secrets { r.renderSingle(result.Target, m) } - return } func (r *secretRenderer) countSeverities(secrets []types.DetectedSecret) map[string]int { @@ -85,7 +84,6 @@ func (r *secretRenderer) renderSingle(target string, secret types.DetectedSecret } func (r *secretRenderer) renderSummary(secret types.DetectedSecret) { - // severity switch secret.Severity { case severityCritical: diff --git a/pkg/report/table/summary.go b/pkg/report/table/summary.go index dee4f06aee..dba99a3735 100644 --- a/pkg/report/table/summary.go +++ b/pkg/report/table/summary.go @@ -201,8 +201,6 @@ func (r *summaryRenderer) Render(report types.Report) { r.printf("Legend:\n" + "- '-': Not scanned\n" + "- '0': Clean (no security findings detected)\n\n") - - return } func (r *summaryRenderer) printf(format string, args ...any) { diff --git a/pkg/report/table/vulnerability.go b/pkg/report/table/vulnerability.go index 548f4871e0..118cccc9d5 100644 --- a/pkg/report/table/vulnerability.go +++ b/pkg/report/table/vulnerability.go @@ -85,8 +85,6 @@ func (r *vulnerabilityRenderer) Render(result types.Result) { } else if len(result.ModifiedFindings) > 0 { showSuppressedOnce() } - - return } func (r *vulnerabilityRenderer) renderDetectedVulnerabilities(result types.Result) {