Turn on pep8 as a voting job for stx-integ

- Convert from pep8 to flake8.
- Add in hacking and bugbear plugins to flake8
- Suppress any flake8 errors that fail.

Future tasks will be created to cleanup and
fix the suppressed error codes.

Story: 2002803
Task: 26884
Change-Id: I8bf0978f27be1cc1108d21a002e650c5072b4c67
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
This commit is contained in:
Al Bailey 2018-10-03 15:38:22 -05:00
parent b9d73c98e1
commit 0844ed02bb
2 changed files with 71 additions and 4 deletions

View File

@ -5,10 +5,10 @@
check:
jobs:
- build-openstack-releasenotes
- openstack-tox-pep8:
voting: false
- openstack-tox-pep8
- openstack-tox-linters
gate:
jobs:
- build-openstack-releasenotes
- openstack-tox-pep8
- openstack-tox-linters

71
tox.ini
View File

@ -34,13 +34,80 @@ commands =
-o -type f -name '*.yaml' \
-print0 | xargs -0 yamllint"
[flake8]
# E series are pep8
# E101 indentation contains mixed spaces and tabs
# E121 continuation line under-indented for hanging indent
# 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
# E201 whitespace after '['
# E202 whitespace before '}'
# E203 whitespace before ':'
# E211 whitespace before '('
# E221 multiple spaces before operator
# E222 multiple spaces after operator
# E225 missing whitespace around operator
# E226 missing whitespace around arithmetic operator
# E231 missing whitespace after ','
# E251 unexpected spaces around keyword / parameter equals
# E261 at least two spaces before inline comment
# E265 block comment should start with '# '
# E266 too many leading '#' for block comment
# E302 expected 2 blank lines, found 1
# E303 too many blank lines
# E305 expected 2 blank lines after class or function definition, found 1
# E402 module level import not at top of file
# E501 line too long > 80
# E711 comparison to None should be 'if cond is None:'
# E722 do not use bare except'
# E741 ambiguous variable name 'O'
# E999 SyntaxError: invalid syntax
# H series are hacking
# H101: Use TODO(NAME)
# H102 is apache license
# H104: File contains nothing but comments
# H201: no 'except:' at least use 'except Exception:'
# H233: Python 3.x incompatible use of print operator
# H237: module exception is removed in Python 3
# H238: old style class declaration, use new style
# H301: one import per line
# H306: imports not in alphabetical order
# H401: docstring should not start with a space
# H404: multi line docstring should start without a leading new line
# H405: multi line docstring summary not separated with an empty line
# W series
# W191 indentation contains tabs
# W291 trailing whitespace
# W391 blank line at end of file
# W503 line break before binary operator
# B series are from bugbear
# B001 Do not use bare `except:
# B007 Loop control variable 'cpu' not used within the loop body.
# B301 Python 3 does not include `.iter*` methods on dictionaries.
# B306 `BaseException.message` has been deprecated as of Python 2.6 and is removed in Python 3.
# F series
# F401 'module' imported but unused
# F841 local variable '_alarm_state' is assigned to but never used
ignore = E101,E121,E123,E124,E125,E126,E127,E128,E201,E202,E203,E211,E221,E222,E225,E226,E231,E251,E261,E265,E266,
E302,E303,E305,E402,E501,E711,E722,E741,E999,
H101,H102,H104,H201,H238,H233,H237,H301,H306,H401,H404,H405,
W191,W291,W391,W503,
B001,B007,B301,B306,
F401,F841
[testenv:pep8]
usedevelop = False
skip_install = True
deps =
pep8
hacking
flake8-bugbear
flake8
commands =
pep8
flake8
[testenv:venv]
commands = {posargs}