integ/tox.ini
Eric Barrett c408ce506e Enable Syntax flake8 Error
Flake8 currently ignores syntax errors
Change python2 style print statements to python3 compatible style
Change in print statements results in new errors discovered by flake8
Fix B006: Do not use mutable data structures for argument defaults error
Fix F821: undefined name 'hashlib' error
Enable syntax errors (E999) for more thorough testing of code

Change-Id: Id8849e4e117ddd1fd50309415466b593d13e7456
Story: 2004515
Task: 30076
Signed-off-by: Eric Barrett <eric.barrett@windriver.com>
2019-03-20 10:19:11 -04:00

176 lines
5.8 KiB
INI

[tox]
envlist = linters
minversion = 2.3
skipsdist = True
stxdir = {toxinidir}/..
[testenv]
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]
basepython = python3
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 -n 1 -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
# 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'
# 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
# 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 = 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,
H101,H102,H104,H201,H238,H233,H237,H306,H401,H404,H405,
W191,W291,W391,W503,
B001,B007,B301,B306,
F401,F841
[testenv:pep8]
basepython = python3
usedevelop = False
skip_install = True
deps =
hacking
flake8-bugbear
flake8<3.6.0
commands =
flake8
[testenv:pylint]
basepython = python2.7
deps = -r{toxinidir}/test-requirements.txt
-e{[tox]stxdir}/stx-update/tsconfig/tsconfig
-e{[tox]stxdir}/stx-fault/fm-api
-e{[tox]stxdir}/stx-config/sysinv/sysinv/sysinv
-e{[tox]stxdir}/stx-config/sysinv/cgts-client/cgts-client
docutils
keyring
libvirt-python
oslo_i18n
oslo_log
oslo_messaging
oslo_service
python-cephclient
python-cinderclient
python-glanceclient
python-keystoneclient
python-novaclient
SQLAlchemy
retrying
python-daemon==2.1.2
pylint
# There are currenrly 5 python modules with a setup.py file
commands = pylint --rcfile=./pylint.rc \
ceph/ceph-manager/ceph-manager/ceph_manager \
logging/logmgmt/logmgmt/logmgmt \
tools/storage-topology/storage-topology/storage_topology \
tools/vm-topology/vm-topology/vm_topology \
utilities/platform-util/platform-util/platform_util
[testenv:venv]
basepython = python3
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]
basepython = python3
# Re-use the releasenotes venv
envdir = {toxworkdir}/releasenotes
deps = -r{toxinidir}/doc/requirements.txt
commands = reno new {posargs}
[testenv:functional]
basepython = python3
whitelist_externals = cat
commands = cat /etc/group