-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Run flake8 instead of pep8 on Python 3.6 #10940
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
.flake8
Outdated
@@ -0,0 +1,2 @@ | |||
[flake8] |
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.
I think the config can also live in pytest.ini (not sure)? That'd help avoid ending with a gazillion config files in the root folder. Also because it makes sense to keep that next to the pep8ignore list.
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.
flake8 is a superset of pep8 (renamed to pycodestyle at the BDFL's request) so if we run flake8, we no longer need to run pycodestyle.
.travis.yml
Outdated
@@ -82,7 +82,7 @@ matrix: | |||
- python: 3.5 | |||
env: PYTHON_ARGS=-OO | |||
- python: 3.6 | |||
env: DELETE_FONT_CACHE=1 PANDAS='pandas<0.21.0' PYTEST_PEP8=pytest-pep8 RUN_PEP8=--pep8 | |||
env: DELETE_FONT_CACHE=1 PANDAS='pandas<0.21.0' PYTEST_PEP8=pytest-flake8 RUN_PEP8=--flake8 |
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.
RUN_FLAKE8
fc04cbe
to
241f11f
Compare
@anntzer Ready for review. |
👍 in principle, but some questions. Does flake8 inherit the pep8 configuration? If not we are going to need the per-file filters. Are the error codes shared between the two? If so, why is the ignore list different? Can you also remove all of the |
The Exxx codes are shared but C901 and the Fxxx codes only exist in flake8 for instance. ALL Python files currently pass with the current flake8-ignore list. I will remove the PEP8 cruft later today. |
Please keep the per-file exception list and do not change the Exxx codes that we are ignoring. Going through and changing working code for purely stylistic reasons is un-needed code-churn and we have had several instances where it has introduced bugs. Having per-file exception lists lets us enforce checks on most files without having to go through fix the handful of failing files. Please set the line check back to 80. I am 👍 on getting the extra checks from pyflakes, I am strongly 👎 on changing what aspect of pycodestyle we are enforcing. |
5aa8afc
to
7552aee
Compare
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.
Doesn't this need to do RUN_PEP8
-> RUN_FLAKE8
in test_script.sh
to actually run flake8?
@dopplershift is right; on |
As discussed at matplotlib#10938 (comment) _undefined names_ have [occurred often in the past](https://github.com/matplotlib/matplotlib/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed) and this change would help to avoid recurrence in the future.
f4c6cf1
to
27dc890
Compare
This update restores the the per-file exception list as requested and adds the following exceptions:
RUN_FLAKE8 is now run in test_script.sh and the number of tests now matches master. The E7's and F4's might be worth fixing in future pull requests. |
- SPHINX=sphinx | ||
# Variables controlling the test run. | ||
- DELETE_FONT_CACHE= | ||
- NO_AT_BRIDGE=1 # Necessary for GTK3 interactive test. | ||
- NPROC=2 | ||
- OPENBLAS_NUM_THREADS=1 | ||
- PYTHONFAULTHANDLER=1 | ||
- PYTEST_ARGS="-rawR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n $NPROC" | ||
- RUN_FLAKE8= |
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.
please move it down (it's in alphabetical order)
I will approve the PR after a rebase (and the minor comment above). I think it is clear that we are constantly introducing bugs in untested paths without that... The added error codes are all reasonable and are only present in pycodestyle, not pep8, so that's why they're needed. |
As discussed at #10938 (comment) undefined names have occurred often in the past and this change would help to avoid recurrence in the future. Flake8 is a superset of pycodestyle (fka PEP8) so we do not need to run both.
PR Summary
PR Checklist