bazelbuild / rules_go

Go rules for Bazel
Apache License 2.0
1.36k stars 638 forks source link

nogo suggestions #1951

Open ash2k opened 5 years ago

ash2k commented 5 years ago

I've started using nogo and I'd like to give some feedback and suggest some minor improvements.

  1. configuring analyzers section mentions that keys are regular expressions - would be useful to make it a link to the regex package where the syntax is described.
  2. Examples of regex keys are misleading e.g. "src/js/*" and "src/(third_party|vendor)/*" are valid regexes, sure, but they look like glob syntax. Should be "src/js/.*" and "src/(third_party|vendor)/.*" probably. But then there is no point in having .* at the end so perhaps something more realistic like "/zz_generated.go$" to skip all generated files would be better? I was confused by examples and had to check the implementation to ensure that it's actually regex and not glob.
  3. Feature request: I was trying to exclude only the "vendor" directory like that: ^vendor/ but it does not work. Presumably because the check is performed against the absolute file path - /vendor/ works fine. But /vendor/ will exclude all directories named like that, not just the one in the root of the project. This might lead to whole subtrees of packages not linted and to overlooked issues. Another case: what if I exclude /tmp/? Nothing at all will be linted because Bazel's output base is /private/var/tmp/ that matches, right? I'm suggesting to check the relative path, not the absolute.

Thank you!

Monnoroch commented 5 years ago

One more suggestion: add configuration for all analyzers. For example, I want to disable all linters in (external|third_party)/* and have to copy-paste it for each linter.