tests: Upgrade pep8 to pycodestyle

The PEP8 [1] project has been renamed to pycodestyle [2].

[1] https://github.com/codeclimate/pep8
[2] https://github.com/pycqa/pycodestyle
This commit is contained in:
Radostin Stoyanov 2017-07-24 09:26:47 +01:00 committed by Cole Robinson
parent 00ffb3340e
commit 2fd6d9aa32
4 changed files with 38 additions and 20 deletions

View File

@ -7,7 +7,7 @@ python setup.py pylint # Run a pylint script against the codebase
```
Any patches shouldn't change the output of 'test' or 'pylint'. The
'pylint' requires `pylint` and `python-pep8` to be installed.
'pylint' requires `pylint` and `pycodestyle` to be installed.
Our pylint script uses a blacklist rather than a whitelist approach,
so it could throw some false positives or useless messages. If you think

View File

@ -566,7 +566,7 @@ class TestInitrdInject(TestBaseCommand):
class CheckPylint(distutils.core.Command):
user_options = []
description = "Check code using pylint and pep8"
description = "Check code using pylint and pycodestyle"
def initialize_options(self):
pass
@ -582,9 +582,9 @@ class CheckPylint(distutils.core.Command):
output_format = sys.stdout.isatty() and "colorized" or "text"
exclude = ["virtinst/progress.py"]
print("running pep8")
cmd = "pep8 "
cmd += "--config tests/pep8.cfg "
print("running pycodestyle")
cmd = "pycodestyle "
cmd += "--config tests/pycodestyle.cfg "
cmd += "--exclude %s " % ",".join(exclude)
cmd += " ".join(files)
os.system(cmd)

View File

@ -1,15 +0,0 @@
[pep8]
format = pylint
# E1* : # Continuation line indents
# E203: # Space before : in dictionary defs
# E221: # Multiple spaces before operator
# (warngs about column aligning assigments)
# E241: # Space after , column alignment nono
# E301: # 1 blank line between methods
# E303: # Too many blank lines
# E402: # [E402] module level import not at top of file
# E501: # Line too long
ignore=E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E203,E221,E241,E301,E303,E402,E501

33
tests/pycodestyle.cfg Normal file
View File

@ -0,0 +1,33 @@
[pycodestyle]
format = pylint
# List of error codes:
# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
# E121: Continuation line under-indented for hanging indent
# E122: Continuation line missing indentation or outdented
# E123: Closing bracket does not match indentation of opening
# bracket's line
# E124: Closing bracket does not match visual indentation
# E125: Continuation line with same indent as next logical line
# E126: Continuation line over-indented for hanging indent
# E127: Continuation line over-indented for visual indent
# E128: Continuation line under-indented for visual indent
# E129: Visually indented line with same indent as next logical line
# E131: Continuation line unaligned for hanging indent
# E203: White-space before ':'
# E221: Multiple spaces before operator
# E241: Multiple spaces after ,
# E301: Expected 1 blank line, found 0
# E303: Too many blank lines
# E305: Expected 2 blank lines after end of function or class
# E306: Expected 1 blank line before a nested definition
# E402: Module level import not at top of file
# E501: Line too long (82 > 79 characters)
# E722: Do not use bare except, specify exception instead
# E741: Do not use variables named l, O, or I
ignore = E122, E123, E124, E125, E126, E127, E128, E129, E131, E203, E221, E241, E301, E303, E305, E306, E402, E501, E722, E741