Page MenuHomePhabricator

[python linting] enforce all flake8 E & W codes besides some exceptions

Authored by markblundeberg on Feb 7 2020, 14:37.



This enforces all pycodestyle rules aside from the ones we currently

Current violations (some of these can be fixed fairly soon,
some are super prevalent)

E265 	Block comment should start with '# '
E501 	Line too long (82 > 79 characters)
E704 	Multiple statements on one line (def)
E712 	Comparison to true should be 'if cond is true:' or 'if cond:'
E713 	Test for membership should be 'not in'
E722 	do not use bare except
E731 	Do not assign a lambda expression, use a def
W503 	Line break occurred before a binary operator
W504 	Line break occurred after a binary operator

More about rules:

These rules aren't often added and if we do get new rules causing issues,
they can be added as exceptions. Note that flake8 is fine if we tell it
to ignore a rule that it doesn't know about.

Flake8 min version has been bumped to 3.0 to support the simultaneous
--select and --ignore. I am guessing most of us are at least on 3.2.1
(ubuntu bionic / debian 9). I've tested on a variety of python / flake8
combinations and the seem to be agreeing that we are clean.

Depends on D5194 D5197

Test Plan
arc lint --everything

Diff Detail

rABC Bitcoin ABC
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

markblundeberg created this revision.Feb 7 2020, 14:37
Herald added a reviewer: Restricted Project. · View Herald TranscriptFeb 7 2020, 14:37
markblundeberg edited the summary of this revision. (Show Details)Feb 7 2020, 14:40
Fabien accepted this revision.Feb 7 2020, 14:46
This revision is now accepted and ready to land.Feb 7 2020, 14:46