Closed Bug 1333092 Opened 7 years ago Closed 7 years ago

Update to newer flake8, pycodestyle (pep8) & pyflakes

Categories

(Tree Management :: Treeherder, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

References

Details

Attachments

(1 file)

flake8 finally supports newer pep8/pyflakes, so we can update and benefit from some new checks.

Breaking out of bug 1333079 since it involves code changes (to fix errors from the new checks) and not just package version changes.
Attachment #8829476 - Flags: review?(wlachance)
Attachment #8829476 - Flags: review?(wlachance) → review+
Commits pushed to master at https://github.com/mozilla/treeherder

https://github.com/mozilla/treeherder/commit/0719fd962852abbfa3eed1463e2499e5137db24e
Bug 1333092 - Fix flake8 F999: dictionary key X repeated

treeherder/webapp/api/jobs.py:88:13: F999 dictionary key 'build_platform_id' repeated with different values
treeherder/webapp/api/jobs.py:97:13: F999 dictionary key 'build_platform_id' repeated with different values

https://github.com/mozilla/treeherder/commit/78dc024094a8d6b5c08fbb3e41b968d40aa0c16c
Bug 1333092 - Fix flake8 E129: visually indented line with same indent

treeherder/autoclassify/detectors.py:32:5: E129 visually indented line with same indent as next logical line
treeherder/autoclassify/matchers.py:174:5: E129 visually indented line with same indent as next logical line
treeherder/etl/artifact.py:164:13: E129 visually indented line with same indent as next logical line
treeherder/webapp/api/performance_serializers.py:80:5: E129 visually indented line with same indent as next logical line

https://github.com/mozilla/treeherder/commit/390cf3afc7ad1b0321dacce522359ae87adcb395
Bug 1333092 - Fix flake8 E305: expected 2 blank lines after definition

tests/client/test_treeherder_client.py:514:1: E305 expected 2 blank lines after class or function definition, found 1
tests/model/test_error_summary.py:66:1: E305 expected 2 blank lines after class or function definition, found 1
tests/model/test_error_summary.py:94:1: E305 expected 2 blank lines after class or function definition, found 1
tests/model/test_error_summary.py:112:1: E305 expected 2 blank lines after class or function definition, found 1
tests/model/test_error_summary.py:148:1: E305 expected 2 blank lines after class or function definition, found 1
tests/model/test_error_summary.py:166:1: E305 expected 2 blank lines after class or function definition, found 1
tests/perfalert/test_analyze.py:94:1: E305 expected 2 blank lines after class or function definition, found 1
tests/webapp/api/test_auth.py:23:1: E305 expected 2 blank lines after class or function definition, found 1
tests/webapp/api/test_version.py:12:1: E305 expected 2 blank lines after class or function definition, found 1
treeherder/config/settings.py:21:1: E305 expected 2 blank lines after class or function definition, found 1
treeherder/credentials/admin.py:10:1: E305 expected 2 blank lines after class or function definition, found 0
treeherder/etl/schema.py:16:1: E305 expected 2 blank lines after class or function definition, found 1
treeherder/model/search.py:56:1: E305 expected 2 blank lines after class or function definition, found 1
treeherder/model/tasks.py:42:1: E305 expected 2 blank lines after class or function definition, found 1

https://github.com/mozilla/treeherder/commit/80dd4cf2ec82389acb826a0e7090c2f26d526cd7
Bug 1333092 - Fix flake8 E402: module level import not at top of file

treeherder/config/wsgi.py:17:1: E402 module level import not at top of file
treeherder/config/wsgi.py:18:1: E402 module level import not at top of file

https://github.com/mozilla/treeherder/commit/0f20ff2569b89aaf8801de1a3819d554759c2367
Bug 1333092 - Update to newer flake8, pycodestyle (pep8) & pyflakes

flake8 has been updated to support the newer versions of pycodestyle
(formerly named pep8) and pyflakes. Some of the new checks are too noisy
so have been added to the ignore list.

Changes:

http://flake8.pycqa.org/en/latest/release-notes/index.html
https://gitlab.com/pycqa/flake8/compare/2.5.4...3.2.1

https://github.com/PyCQA/pycodestyle/blob/master/CHANGES.txt
https://github.com/PyCQA/pycodestyle/compare/1.5.7...2.2.0

https://github.com/PyCQA/pyflakes/blob/master/NEWS.txt
https://github.com/PyCQA/pyflakes/compare/1.0.0...1.3.0

https://github.com/PyCQA/mccabe/blob/master/README.rst#changes
https://github.com/PyCQA/mccabe/compare/0.4.0...0.5.3
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
FWIW I particuarly think that E129 (which makes you undergo weird contortions for the very common pattern of

if (foo and
    bar):

is an antipattern and the right thing to do is disable that check, always.
I'm open to discussing which stock pycodestyle rules we choose to override - if you feel strongly lets discuss in a new bug :-)
Blocks: 1337726
Component: Treeherder: Docs & Development → TreeHerder
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: