0844ed02bb
- 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>
138 lines
4.7 KiB
INI
138 lines
4.7 KiB
INI
[tox]
|
|
envlist = linters
|
|
minversion = 2.3
|
|
skipsdist = True
|
|
|
|
[testenv]
|
|
basepython = python3
|
|
install_command = pip install -U {opts} {packages}
|
|
setenv = VIRTUAL_ENV={envdir}
|
|
OS_STDOUT_CAPTURE=1
|
|
OS_STDERR_CAPTURE=1
|
|
OS_TEST_TIMEOUT=60
|
|
deps = -r{toxinidir}/test-requirements.txt
|
|
|
|
[testenv:linters]
|
|
whitelist_externals = bash
|
|
#bashate ignore
|
|
#E006 Line too long
|
|
#E041 Arithmetic expansion using $[ is deprecated for $((
|
|
#E042 local declaration hides errors
|
|
#E043 Arithmetic compound has inconsistent return semantics
|
|
#E044 Use [[ for non-POSIX comparisions
|
|
commands =
|
|
bash -c "find {toxinidir} \
|
|
-not \( -type d -name .?\* -prune \) \
|
|
-type f \
|
|
-not -name \*~ \
|
|
-not -name \*.md \
|
|
-name \*.sh \
|
|
-print0 | xargs -0 bashate -v \
|
|
-i E006,E041,E042,E043,E044 -e E*"
|
|
bash -c "find {toxinidir} \
|
|
\( -path {toxinidir}/.tox \) -a -prune \
|
|
-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 =
|
|
hacking
|
|
flake8-bugbear
|
|
flake8
|
|
commands =
|
|
flake8
|
|
|
|
[testenv:venv]
|
|
commands = {posargs}
|
|
|
|
[testenv:docs]
|
|
basepython = python3
|
|
deps = -r{toxinidir}/doc/requirements.txt
|
|
commands =
|
|
rm -rf doc/build
|
|
sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html
|
|
whitelist_externals = rm
|
|
|
|
[testenv:releasenotes]
|
|
basepython = python3
|
|
deps = -r{toxinidir}/doc/requirements.txt
|
|
commands =
|
|
rm -rf releasenotes/build
|
|
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
|
whitelist_externals =
|
|
rm
|
|
reno
|
|
|
|
[testenv:newnote]
|
|
# Re-use the releasenotes venv
|
|
envdir = {toxworkdir}/releasenotes
|
|
deps = -r{toxinidir}/doc/requirements.txt
|
|
commands = reno new {posargs}
|