forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pythonstyle: Fix suppression support; improve SyntaxError reporting; …
…Only report each nit once This patch cleans up a number of issues I encountered while trying to fix suppression support in the Python style checks. * The suppression option wasn't working as expected because the file names passed to it were changed from relative to absolute. This moves parsing into get_nits so that it has access to the relative file path. * SyntaxErrors show only the default error message without any source context. This patch adds source context display to syntax errors. * Multiline nits are counted and outputed once for each line they contain. This changes it so that they are only counted and logged once. The one change I want to call out specifically is that I changed Nit so that it doesn't know about the PythonFile anymore. I did this so that I could make a nit for SyntaxErrors without introducing a variant of PythonFile for syntactically incorrect Python files. If there are external plugins that rely on Nit's current structure, this may break them. Testing Done: Wrote a test covering using suppression, and fixed it. Then added more tests around syntax error handling and fixed those. After doing some testing, I noticed the multi-line display issue and fixed that as well following the same process. CI away on the PR. Bugs closed: 3128, 3139 Reviewed at https://rbcommons.com/s/twitter/r/3647/ closes pantsbuild#3128 closes pantsbuild#3139
- Loading branch information
1 parent
2916531
commit 8479b6a
Showing
11 changed files
with
213 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.