nilaway
nilaway copied to clipboard
Feature Request: Running against generated and vendored code
👋
The tool is not taking into consideration generated code, mocks and vendored directories. It would be nice to be able to explicitly exclude these. Exclusion options exist for -exclude-errors-in-files
, -exclude-file-docstrings
, -exclude-pkgs
but they don't fully meet the needs of entire folder exclusion or generated code that follows the best practice package comments marking generated code (// Code generated by
).
The generated code standard: ^// Code generated .* DO NOT EDIT\.$
@stephensli , thanks for raising this issue. We currently do not support for regex or glob patterns when specifying include or exclude lists. We do plan add regex support soon. Thanks, @dolmen, for the pointer! 👍
Please also add support for excluding code that is put into the standard vendor
dir by the standard go mod vendor
command. I think, this vendor
-exclusion should be on by default.
Currently I have to always rm -rf vendor
before nilaway ./...
to check the current modules code only.
I have the same problem with code in the vendor directory. An option to ignore that directory would be super helpful.
If generated code is in special folders, like mocks, we should be able to skip those folders with the -exclude-pkgs flag. but it is unclear how to use that, because nilaway -exclude-pkgs "mocks" doesn't work. (neither does "./mocks" or "./.../mocks") I expect based on the little documentation there is, that a package name should be the value here.