Report Nogo errors on only changed files.
Hi,
Recently i was trying to get Nogo integrated with our existing Repo. One major integration hurdle I faced was, When running nogo enabled, the bazel build fails on existing linter issues, even on files that the developer has not touched.
Given we have a large repo and with many services, we wanted to throw lint errors only on changed files. I made some hacky patch to lint and report issues on only files the author has touched to overcome this. So wanted to understand if there's anything on the roadmap to lint only the changes?
The problem is that Bazel doesn't know which files changed. I guess we could offer a flag that you could supply a list of files to and then we would only report findings in these files.
@linzhp @jayconrod since this ties into our ongoing discussion on nogo scopes
Could the job that runs Nogo first write the Nogo JSON configuration file, indicating which files should be reported? That seems like the best way to handle this for now, though we're talking about changing how that file works.
Bazel and Nogo can't figure out which files will be relevant for the build. They can't necessarily detect the set of changed files, and that set may not be useful. A file could change in a way that would cause an error to be reported for a calling function in another file, maybe in another package.
@moisesvega made an internal tool in Uber that does just that. The tool wraps nogo and swallow all diagnostics outside the changed lines.
Maybe we can make it more generic and open source? @sywhang
We weren't considering open sourcing this any time soon, but it's not out of question. It's mainly around prioritization and resourcing but we can look into sharing our learnings on this front with the broader community hopefully soon.
Thanks all for the reply and guidance. Yes i understand, bazel wont be able to figure out which files changed. I made the same changes to report only on changed files (not on changed lines). But wanted to understand if there's anything on the roadmap and if this is indeed a problem for others.
Thanks @sywhang @linzhp , would be interested in that.
I can share the approach i had taken till now, but need to check with my team on this before that (will get back to you on that soon).