Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A recent commit causes gocyclo to run on the vendor directory #366

Open
ejweber opened this issue Dec 2, 2021 · 1 comment
Open

A recent commit causes gocyclo to run on the vendor directory #366

ejweber opened this issue Dec 2, 2021 · 1 comment

Comments

@ejweber
Copy link

ejweber commented Dec 2, 2021

Changes made in 87e76db cause gocyclo to run on the vendor directory.

Specifically, the following lines change the last argument of metalinter from "./..." to ".", but only for gocyclo.

goreportcard/check/utils.go

Lines 338 to 342 in 87e76db

if strings.Contains(command[len(command)-1], "cyclo") {
params = append(params, dir)
} else {
params = append(params, dir+"/...")
}

It's not clear why the change was made, but running metalinter on the BeeGFS CSI driver with "./..." yields the results I expect:

[user@webere-dev beegfs-csi-driver]$ gometalinter --deadline=180s --disable-all --enable=gocyclo --cyclo-over=15 --skip=Godeps --skip=vendor --skip=third_party --skip=testdata ./...
operator/controllers/beegfsdriver_controller.go:83::warning: cyclomatic complexity 87 of function (*BeegfsDriverReconciler).Reconcile() is high (> 15) (gocyclo)
release-tools/filter-junit.go:74::warning: cyclomatic complexity 16 of function main() is high (> 15) (gocyclo)
operator/controllers/beegfsdriver_controller.go:83::warning: cyclomatic complexity 87 of function (*BeegfsDriverReconciler).Reconcile() is high (> 15) (gocyclo)
pkg/beegfs/beegfs_util.go:61::warning: cyclomatic complexity 23 of function writeClientFiles() is high (> 15) (gocyclo)
pkg/beegfs/controllerserver.go:77::warning: cyclomatic complexity 18 of function (*controllerServer).CreateVolume() is high (> 15) (gocyclo)

Running it with the new update yields many more warnings, all in the vendor directory:

[user@webere-dev beegfs-csi-driver]$ gometalinter --deadline=180s --disable-all --enable=gocyclo --cyclo-over=15 --skip=Godeps --skip=vendor --skip=third_party --skip=testdata .
vendor/k8s.io/kubernetes/pkg/apis/core/v1/zz_generated.conversion.go:43::warning: cyclomatic complexity 429 of function RegisterConversions() is high (> 15) (gocyclo)
vendor/google.golang.org/protobuf/internal/impl/codec_tables.go:37::warning: cyclomatic complexity 200 of function fieldCoder() is high (> 15) (gocyclo)
vendor/github.com/felixge/httpsnoop/wrap_generated_gteq_1.8.go:66::warning: cyclomatic complexity 161 of function Wrap() is high (> 15) (gocyclo)
vendor/github.com/gogo/protobuf/proto/table_marshal.go:570::warning: cyclomatic complexity 152 of function typeMarshaler() is high (> 15) (gocyclo)
vendor/github.com/gogo/protobuf/proto/table_merge.go:163::warning: cyclomatic complexity 127 of function (*mergeInfo).computeMergeInfo() is high (> 15) (gocyclo)
vendor/github.com/gogo/protobuf/proto/table_unmarshal.go:470::warning: cyclomatic complexity 125 of function typeUnmarshaler() is high (> 15) (gocyclo)
vendor/google.golang.org/protobuf/proto/decode_gen.go:194::warning: cyclomatic complexity 115 of function (UnmarshalOptions).unmarshalList() is high (> 15) (gocyclo)
vendor/github.com/imdario/mergo/merge.go:58::warning: cyclomatic complexity 112 of function deepMerge() is high (> 15) (gocyclo)
vendor/google.golang.org/protobuf/internal/impl/validate.go:225::warning: cyclomatic complexity 112 of function (*MessageInfo).validate() is high (> 15) (gocyclo)
vendor/golang.org/x/net/html/parse.go:864::warning: cyclomatic complexity 109 of function inBodyIM() is high (> 15) (gocyclo)
vendor/k8s.io/client-go/informers/generic.go:91::warning: cyclomatic complexity 96 of function (*sharedInformerFactory).ForResource() is high (> 15) (gocyclo)
vendor/github.com/jmespath/go-jmespath/interpreter.go:31::warning: cyclomatic complexity 89 of function (*treeInterpreter).Execute() is high (> 15) (gocyclo)
vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/colorable_windows.go:353::warning: cyclomatic complexity 89 of function (*Writer).Write() is high (> 15) (gocyclo)
operator/controllers/beegfsdriver_controller.go:83::warning: cyclomatic complexity 87 of function (*BeegfsDriverReconciler).Reconcile() is high (> 15) (gocyclo)
vendor/gopkg.in/yaml.v2/scannerc.go:2314::warning: cyclomatic complexity 81 of function yaml_parser_scan_flow_scalar() is high (> 15) (gocyclo)

# and many more...
@ejweber
Copy link
Author

ejweber commented Dec 2, 2021

I should mention that, while I am running gometalinter directly in the above examples, these gocyclo issues are included in the goreportcard-cli output as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant