Closed Bug 1059814 Opened 10 years ago Closed 9 years ago

Fix treeherder-service pep8 warnings

Categories

(Tree Management :: Treeherder, defect, P4)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

References

Details

Attachments

(3 files)

I've excluded "E501 line too long", since that's annoying.
There may be others that we decide to exclude too.

(pep8 output too long for a comment, see attachment)
Priority: P4 → P3
Blocks: 1072681
Blocks: 1107523
No longer blocks: 1072681
Assignee: nobody → emorley
Attachment #8564624 - Flags: review?(mdoglio)
Status: NEW → ASSIGNED
Attachment #8564624 - Flags: review?(mdoglio) → review+
Commit pushed to master at https://github.com/mozilla/treeherder-service

https://github.com/mozilla/treeherder-service/commit/f5c0b53e0ce6b527c5eb2d861adeb72e1e5859ea
Bug 1059814 - Whitespace pep8 fixes

Generated using:
autopep8 --in-place --recursive .

Before:
$ pep8 | wc -l
1686

After:
$ pep8 | wc -l
57

A later autopep8 run will be performed using --aggressive, which makes
non-whitespace changes too.
Depends on: 1133362
Attachment #8564624 - Flags: checkin+
Priority: P3 → P4
Attachment #8570006 - Flags: review?(cdawson)
Commit pushed to master at https://github.com/mozilla/treeherder-service

https://github.com/mozilla/treeherder-service/commit/ebd237d5a0f572949339f4a34379c66c4441b6e7
Bug 1059814 - Deploy script: Remove unnecessary sys.path additions

The directory of the currently running script is already on the path:
https://docs.python.org/2/tutorial/modules.html#the-module-search-path
...so adding it is unnecessary.

In addition, I don't believe we need the treeherder-service directory on
the path, since we don't directly import anything from there.
Commit pushed to master at https://github.com/mozilla/treeherder-service

https://github.com/mozilla/treeherder-service/commit/c0e59f9beacde65f25e29f625d0740146416f95f
Bug 1059814 - Deploy script: Fix commander_settings import

Apparently the current directory is only sometimes on the path & I
mis-read or understood the docs, sigh. Let's just keep the sys.path
manipulation and use #noqa to keep flake8 quiet.
Attachment #8570006 - Flags: review?(cdawson) → review+
Commits pushed to master at https://github.com/mozilla/treeherder-service

https://github.com/mozilla/treeherder-service/commit/30ad99c7c0951036383f2603a55593230d7e314d
Bug 1059814 - Non-whitespace pep8 fixes using autopep8 aggressive mode

Generated using:
autopep8 --in-place --recursive --aggressive --aggressive
--max-line-length 999 --exclude='.git,__pycache__,.vagrant,build,vendor,
0001_initial.py,models.py,test_note_api.py,test_bug_job_map_api.py' .

autopep8's aggressive mode, unlike standard mode, makes non-whitespace
changes. It also uses lib2to3 to correct deprecated code (W690), some of
which aren't pep8 failures. Some of these changes are more dubious, but
rather than disable W690 completely, I've just excluded the files where
the unwanted changes would have been made, so we can benefit from the
rest.

https://github.com/mozilla/treeherder-service/commit/8718ccc5fd9e3d828574e20aa7fb2e8ca12632e7
Bug 1059814 - Manual whitespace fixes for pep8

https://github.com/mozilla/treeherder-service/commit/05b3cebfa4691637d3b084cbcf0380c36b5f6a3b
Bug 1059814 - Fix pep8/pyflakes E712, E713, E731, W503

Fixes:
tests/model/derived/test_jobs_model.py:343:23: E712 comparison to False should be 'if cond is False:' or 'if not cond:'
treeherder/__init__.py:11:1: E731 do not assign a lambda expression, use a def
treeherder/etl/buildapi.py:107:16: E713 test for membership should be 'not in'
treeherder/log_parser/utils.py:183:33: W503 line break before binary operator
treeherder/model/derived/base.py:73:12: E713 test for membership should be 'not in'
treeherder/model/derived/base.py:82:12: E713 test for membership should be 'not in'
treeherder/model/derived/jobs.py:1998:26: W503 line break before binary operator

https://github.com/mozilla/treeherder-service/commit/c0fdeb0fa5179c442f67ac2362d10ea9c0da37e4
Bug 1059814 - Clean up and reorder imports to fix pep8 E402

Fixes:
events/run_socketio.py:5:1: E265 block comment should start with '# '
events/run_socketio.py:12:1: E402 module level import not at top of file
events/run_socketio.py:13:1: E402 module level import not at top of file
events/run_socketio.py:14:1: E402 module level import not at top of file
events/run_socketio.py:15:1: E402 module level import not at top of file
events/run_socketio.py:21:1: E402 module level import not at top of file
events/run_socketio.py:22:1: E402 module level import not at top of file
settings/base.py:186:1: E402 module level import not at top of file
settings/base.py:220:1: E402 module level import not at top of file
webapp/wsgi.py:40:1: E402 module level import not at top of file

https://github.com/mozilla/treeherder-service/commit/3e76e3a66fe3e6cbcc405e7be93ec86b194c8e62
Bug 1059814 - Remove admin.autodiscover() since it's now redundant

As of Django 1.7, calling autodiscover() is now unnecessary:
https://docs.djangoproject.com/en/1.7/ref/contrib/admin/#django.contrib.admin.autodiscover

Removing this fixes:
treeherder/webapp/urls.py:15:1: E402 module level import not at top of file
[~/src/treeherder-service]$ flake8 | wc -l
0
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: