Open timburks opened 2 years ago
Considering the number of warnings coming from generated code, we will probably want to exclude those files from linting or ignore results from them.
$ staticcheck ./... | wc -l
183
$ staticcheck ./... | grep "rpc/generated" | wc -l
122
$ staticcheck ./... | grep -v "rpc/generated" | wc -l
61
$ staticcheck ./... | grep -v "rpc/generated"
cmd/registry/cmd/auth/print_token.go:36:13: error strings should not be capitalized (ST1005)
cmd/registry/cmd/auth/print_token.go:36:13: error strings should not end with punctuation or newlines (ST1005)
cmd/registry/cmd/auth/print_token.go:46:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/auth/print_token.go:46:12: error strings should not end with punctuation or newlines (ST1005)
cmd/registry/cmd/compute/score.go:78:4: redundant return statement (S1023)
cmd/registry/cmd/compute/scorecard.go:77:4: redundant return statement (S1023)
cmd/registry/cmd/config/configurations/activate.go:39:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/configurations/activate.go:44:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/configurations/create.go:41:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/configurations/create.go:41:12: error strings should not end with punctuation or newlines (ST1005)
cmd/registry/cmd/config/configurations/create.go:54:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/configurations/create.go:60:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/configurations/delete.go:51:13: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/configurations/delete.go:51:13: error strings should not end with punctuation or newlines (ST1005)
cmd/registry/cmd/config/configurations/delete.go:59:13: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/configurations/delete.go:59:13: error strings should not end with punctuation or newlines (ST1005)
cmd/registry/cmd/config/configurations/describe.go:36:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/configurations/describe.go:40:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/configurations/describe.go:45:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/configurations/list.go:41:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/configurations/list.go:46:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/get.go:35:13: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/get.go:35:13: error strings should not end with punctuation or newlines (ST1005)
cmd/registry/cmd/config/get.go:37:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/get.go:46:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/list.go:35:13: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/list.go:35:13: error strings should not end with punctuation or newlines (ST1005)
cmd/registry/cmd/config/list.go:37:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/list.go:42:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/set.go:43:13: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/set.go:43:13: error strings should not end with punctuation or newlines (ST1005)
cmd/registry/cmd/config/set.go:45:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/set.go:54:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/set.go:58:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/unset.go:35:13: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/unset.go:35:13: error strings should not end with punctuation or newlines (ST1005)
cmd/registry/cmd/config/unset.go:37:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/unset.go:41:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/config/unset.go:45:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/export/csv.go:44:12: error strings should not be capitalized (ST1005)
cmd/registry/cmd/upload/bulk/discovery.go:137:10: error strings should not be capitalized (ST1005)
cmd/registry/cmd/upload/bulk/openapi.go:205:10: error strings should not be capitalized (ST1005)
cmd/registry/cmd/upload/bulk/protos.go:223:10: error strings should not be capitalized (ST1005)
cmd/registry/conformance/conformance-task.go:155:15: error strings should not be capitalized (ST1005)
cmd/registry/conformance/conformance-task.go:167:15: error strings should not be capitalized (ST1005)
cmd/registry/conformance/conformance-task.go:177:15: error strings should not be capitalized (ST1005)
cmd/registry/conformance/conformance-task.go:182:15: error strings should not be capitalized (ST1005)
cmd/registry/conformance/linter.go:78:15: error strings should not be capitalized (ST1005)
cmd/registry/controller/controller.go:217:22: error strings should not be capitalized (ST1005)
cmd/registry/core/print.go:161:10: error strings should not be capitalized (ST1005)
cmd/registry/patterns/parser.go:201:15: error strings should not be capitalized (ST1005)
cmd/registry/patterns/resources.go:27:7: var ResourceUpdateThresholdSeconds is of type time.Duration; don't use unit-specific suffix "Seconds" (ST1011)
cmd/registry/scoring/expression_test.go:21:2: "github.com/golang/protobuf/proto" is deprecated: Use the "google.golang.org/protobuf/proto" package instead. (SA1019)
cmd/registry/scoring/score_test.go:26:2: "github.com/golang/protobuf/proto" is deprecated: Use the "google.golang.org/protobuf/proto" package instead. (SA1019)
pkg/config/config.go:35:2: error var NoActiveConfigurationError should have name of the form ErrFoo (ST1012)
pkg/config/config.go:35:31: error strings should not be capitalized (ST1005)
pkg/config/config.go:35:31: error strings should not end with punctuation or newlines (ST1005)
pkg/config/config.go:43:2: error var CannotDeleteActiveError should have name of the form ErrFoo (ST1012)
pkg/config/config.go:43:28: error strings should not be capitalized (ST1005)
pkg/config/config.go:44:2: error var ReservedConfigNameError should have name of the form ErrFoo (ST1012)
pkg/config/config.go:220:13: error strings should not end with punctuation or newlines (ST1005)
Perhaps we can work to get the generator fixed as well?
@theganyo Here's a discussion about the generator that I forgot to link: https://github.com/googleapis/gapic-generator-go/issues/1138
From https://golangci-lint.run/usage/linters, a description of enabled linters:
"It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint."
FYI, there is a github action here: https://github.com/marketplace/actions/staticcheck. If we go forward with this, we'll need to find a way to avoid the generate code.
Should we do this? (If the consensus is "yes", let's relabel this as an enhancement)
My VSCode configuration shows warnings from staticcheck but we don't get them from our existing linting (#744, #746, #747, #748, #749, #750, #751, #752, #753)
https://staticcheck.io/docs/getting-started/