Open jpeach opened 8 months ago
Or the "all" and "-ST1000" type syntax. Currently I can't copy the list of analyzers from my "staticcheck.conf", as it is of the form
["all", "-ST1000", "-ST1003"]
We don't support the all
syntax. But we do export a constant with all analyzers and we also support the -
prefix to exclude some analyzers.
For more details, see https://github.com/sluongng/nogo-analyzer/blob/fc5266f408ed9956e560cce4b988fdbb9b887200/staticcheck/def.bzl#L207-L208
An example of using it could be found here https://github.com/buildbuddy-io/buildbuddy/blob/09476dae4223fad357d6220be5e5231ecef34f45/BUILD#L135-L158
As for the glob syntax, I highly doubt that we would be able to support it with the current setup.
The reason is that we are declaring each analyzer as its own dedicated Go package. This lets us have a dedicated Bazel target for each analyzer, allowing fine-grained build and dependencies. This lets us do the analyzer selection on the starlark level, which does not provide a globbing matcher on a list of strings.
We could, theoretically group this analyzer up into bigger packages. Such as grouping all QF
under the same package and moving the analyzer selection from Starlark down to the Go level. However, that does come with a certain set of tradeoffs and I am not sure if it's worth it.
For that reason, I am not motivated to work on such a change. But if someone is willing to put in the work to investigate the feasibility and contribute to such change, then we can review and eventually merge it (given that it's an improvement).
staticcheck supports using globs to enable and disable specific checks. This doesn't work in the analyzer, resulting in
Error in pop: KeyError: "@com_github_sluongng_nogo_analyzer//staticcheck:QF*"
.It would be great to support the glob syntax.
https://staticcheck.dev/docs/configuration/options/