-
-
Notifications
You must be signed in to change notification settings - Fork 669
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
RFC: nogo ignore generated source code #2996
RFC: nogo ignore generated source code #2996
Conversation
I wrote this RFC at a late hour on a Sunday and I think I might have jumped some words, making the PR description a bit gibberish to read through. I do apologies and have since tried to make some edit to fix some of the obvious mistakes. But if you see any incomplete sentences and things don't make sense, please do ask questions!
Digging a bit more into commit history and this seems to explained it.
So While Jay is inactive, I see @steeve was active in #1957 so a small ping for comment request 🤗 |
With regards to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments. Otherwise looks good to me
Also, can you add some tests to |
Thanks for the review. All suggestions applied 🤝
Let me look into this in the next few days. |
@linzhp I have a hard time writing test for this PR. So I raised #3129 in order to get the standard staticcheck analyzers into rules_go first. Once thats resolved, we can simply have a test that would enable all staticcheck analyzers in a build. Some analyzer would then fail and this PR should help fixing that. |
Implements a map that track usages of: - Generated source code by rules_go - Rewritten source code by rules_go In case of generated source code, nogo will ignore those files by default. In case of rewritten source code (i.e. coverage tests), nogo should only be run over the original source file.
e63e6bb
to
856955e
Compare
I will close this RFC for now. I have a series of PRs prepared with up-to-date code + new tests that should make this a bit nicer to review. |
Implements a map that track usages of:
In case of generated source code, nogo will ignore those files by
default. In case of rewritten source code (i.e. coverage tests), nogo
should only be run over the original source file.
What type of PR is this?
Bug fix
What does this PR do? Why is it needed?
Enabled staticcheck to run in 2 cases:
Which issues(s) does this PR fix?
Fixes #2984
Other notes for review
This is a more complex, experimental fix to replace #2995 as discussed in #2984.
It's worth noting how these code and logic are also duplicated in file
go/tools/builders/compile.go
but I could not find howcompile.go
is used. Through out my testing, only changes tocompilepkg.go
get picked up, so I did not bother updating the other file.Similarly, coverage test rewrite logic is also shown in
go/private/actions/cover.bzl
but I don't see how that is used through out my testing.Although I have done some rudimentary testing to ensure that this does indeed work on a real repo, this PR should be considered as an RFC and reviewed carefully as the current code health of this file is not the best there is.