-
Notifications
You must be signed in to change notification settings - Fork 223
Add flake8 linter and do style fixes #246
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
Conversation
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.
Amazing work! TIL autopep...
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.
---BEGIN-SCRIPTED-DIFF--- autopep8 --select E1 --in-place test/*.py hwilib/*.py hwilib/devices/*.py hwi.py ---END-SCRIPTED-DIFF---
Fixes E2 whitespace errors except for E261 (double space before inline comment) ---BEGIN-SCRIPTED-DIFF--- autopep8 --select E20,E21,E22,E23,E24,E25,E262,E265,E266,E27 --in-place test/*.py hwilib/*.py hwilib/devices/*.py hwi.py ---END-SCRIPTED-DIFF---
Fix E3 blank line errors except for E302 (expected 2 blank lines, found 0) and E305 (expected 2 blank lines after end of function or class) ---BEGIN-SCRIPTED-DIFF--- autopep8 --select E301,E303,E304,E306 --in-place test/*.py hwilib/*.py hwilib/devices/*.py hwi.py ---END-SCRIPTED-DIFF---
---BEGIN-SCRIPTED-DIFF--- autopep8 --select E4 --in-place test/*.py hwilib/*.py hwilib/devices/*.py hwi.py ---END-SCRIPTED-DIFF---
---BEGIN-SCRIPTED-DIFF--- autopep8 --select E502 --in-place test/*.py hwilib/*.py hwilib/devices/*.py hwi.py ---END-SCRIPTED-DIFF---
---BEGIN-SCRIPTED-DIFF--- autopep8 --select E7 --in-place test/*.py hwilib/*.py hwilib/devices/*.py hwi.py ---END-SCRIPTED-DIFF---
Fixes E711 (comparison to None should be ‘if cond is None:’), E712 (comparison to True should be ‘if cond is True:’ or ‘if cond:’), and E713 (test for membership should be ‘not in’) errors as listed by `flake8 --select=E7`
---BEGIN-SCRIPTED-DIFF--- autopep8 --select W --in-place test/*.py hwilib/*.py hwilib/devices/*.py hwi.py ---END-SCRIPTED-DIFF---
Remove or unassign unused variables as listed by `flake8 --select=F841`
Removed everything listed by `flake8 --select=F401`
Fixes F821 undefined name errors as reported by `flake8 --select=F821`
Remove * imports with explicit name imports as listed by `flake8 --select=F403,F405`
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.
re-ACK d07e102
ACK d07e102 -- diff looks correct In addition to |
I don't care about formatting that much and IMO black's style is too restrictive. |
d07e102 Add lint stage that runs flake8 (Andrew Chow) ecbb847 Add flake8 as a dev dependency (Andrew Chow) a57754c Add autopep8 as dev dependency and script to run it (Andrew Chow) ba7e7c0 Fix F403 and F405 star imports (Andrew Chow) 755af90 Fix F821 Undefined name errors (Andrew Chow) a3bb0a4 Fix F401 Unused import errors (Andrew Chow) 9042e22 Fix F841 local variable is assigned to but never used (Andrew Chow) 709694b Fix W whitespace warnings (Andrew Chow) 6e1afdb Fix E71 errors that autopep8 can't fix automatically (Andrew Chow) 9b60bec Fix E7 statement errors (Andrew Chow) 50afb0c Fix E502 redundant backslashes (Andrew Chow) 1798002 Fix E4 import errors (Andrew Chow) 51182d5 Fix E3 blank line errors (Andrew Chow) da2dce3 Fix E2 whitespace errors (Andrew Chow) 860c5d3 Fix E1 indentation errors (Andrew Chow) 632d47b Add flake8 configuration (Andrew Chow) Pull request description: Adds support for using the flake8 linter and a travis job that runs it to check for code style and other errors. Also adds a script for using the autopep8 formatter and applies the suggested changes. Both autopep8 and flake8 are added as developer dependencies in pyproject.toml. Most of the fixes can be done by running an autopep8 command and are indicated as such in the commit message using the scripted-diff format even though scripted diffs aren't actually being checked by travis. Closes #221 Closes #192 ACKs for top commit: practicalswift: ACK d07e102 -- diff looks correct fanquake: re-ACK d07e102 Tree-SHA512: b19c652f754b67c8605c5126ea0498e10512051db8a7815ecb77cb13050ae2bba7d4e3cd5512f47d6ba78432717d915a3f86ae1864f48beab3a3e4ee08ec4a7b
Adds support for using the flake8 linter and a travis job that runs it to check for code style and other errors. Also adds a script for using the autopep8 formatter and applies the suggested changes. Both autopep8 and flake8 are added as developer dependencies in pyproject.toml.
Most of the fixes can be done by running an autopep8 command and are indicated as such in the commit message using the scripted-diff format even though scripted diffs aren't actually being checked by travis.
Closes #221
Closes #192