monitoring/tox.ini

79 lines
2.5 KiB
INI

[tox]
envlist = linters,pylint
minversion = 2.3
skipsdist = True
sitepackages=False
[testenv]
install_command = pip install -U {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_DEBUG=1
OS_LOG_CAPTURE=1
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
whitelist_externals =
bash
[testenv:bashate]
# Treat all E* codes as Errors rather than warnings using: -e 'E*'
commands =
bash -c "find {toxinidir} \
-not \( -type d -name .?\* -prune \) \
-type f \
-not -name \*~ \
-not -name \*.md \
-name \*.sh \
-print0 | xargs -r -n 1 -0 bashate -v \
-e 'E*'"
[flake8]
# Note: hacking pulls in flake8 2.5.5 which can not parse an ignore list spanning multiple lines
# F errors are high priority to fix. W are warnings. E series are pep8, H series are hacking
# F401 'FOO' imported but unused
# F841 local variable 'foo' is assigned to but never used
# W291 trailing whitespace
# W503 line break before binary operator
# W504 line break after binary operator
# W605 invalid escape sequence '\d'
# E117 over-indented
# E265 block comment should start with '# '
# E266 too many leading '#' for block comment
# E305 expected 2 blank lines after class or function definition, found 1
# E402 module level import not at top of file
# E722 do not use bare 'except'
# E741 ambiguous variable name 'I'
# F632 use ==/!= to compare constant literals (str, bytes, int, float, tuple)
# F821 undefined name 'dpdk' (this is a flake8 bug)
# H101 is TODO
# H104 File contains nothing but comments
# H201 no 'except:' at least use 'except Exception:'
# H238 old style class declaration, use new style (inherit from `object`)
# H306 imports not in alphabetical order (sys, re)
ignore=F401,F632,F821,F841,W291,W503,W504,W605,E117,E265,E266,E305,E402,E722,E741,
H101,H104,H201,H238,H306
max-line-length=110
[testenv:flake8]
commands =
flake8
[testenv:linters]
commands =
{[testenv:bashate]commands}
{[testenv:flake8]commands}
[testenv:pylint]
basepython = python3
description = Dummy environment to allow pylint to be run in subdir tox
# deps = -r{toxinidir}/test-requirements.txt
[testenv:bandit]
basepython = python3
description = Bandit code scan for *.py files under config folder
deps = -r{toxinidir}/test-requirements.txt
commands = bandit -r {toxinidir}/ -x '**/.tox/**,**/.eggs/**' -lll