ssh-audit/tox.ini

139 lines
3.5 KiB
INI

[tox]
envlist =
py{py3}-{test,pylint,flake8,vulture}
py{35,36,37,38}-{test,mypy,pylint,flake8,vulture}
cov
skip_missing_interpreters = true
[testenv]
deps =
test: pytest<6.0
test,cov: {[testenv:cov]deps}
test,py{35,36,37,38}-{type,mypy}: colorama
py{35,36,37,38}-{type,mypy}: {[testenv:mypy]deps}
py{py3,35,36,37,38}-{lint,pylint},lint: {[testenv:pylint]deps}
py{py3,35,36,37,38}-{lint,flake8},lint: {[testenv:flake8]deps}
py{py3,35,36,37,38}-{lint,vulture},lint: {[testenv:vulture]deps}
setenv =
SSHAUDIT = {toxinidir}/src
test: COVERAGE_FILE = {toxinidir}/.coverage.{envname}
type,mypy: MYPYPATH = {toxinidir}/test/stubs
type,mypy: MYPYHTML = {toxinidir}/reports/html/mypy
commands =
test: coverage run --source ssh_audit -m -p -- \
test: pytest -v --junitxml={toxinidir}/reports/junit.{envname}.xml {posargs:test}
test: coverage combine
test: coverage report --show-missing
test: coverage html -d {toxinidir}/reports/html/coverage.{envname}
py{35,36,37,38}-{type,mypy}: {[testenv:mypy]commands}
py{py3,35,36,37,38}-{lint,pylint},lint: {[testenv:pylint]commands}
py{py3,35,36,37,38}-{lint,flake8},lint: {[testenv:flake8]commands}
py{py3,35,36,37,38}-{lint,vulture},lint: {[testenv:vulture]commands}
ignore_outcome =
type: true
lint: true
[testenv:cov]
deps =
coverage
setenv =
COVERAGE_FILE = {toxinidir}/.coverage
commands =
coverage erase
coverage combine
coverage report --show-missing
coverage xml -i -o {toxinidir}/reports/coverage.xml
coverage html -d {toxinidir}/reports/html/coverage
[testenv:mypy]
deps =
colorama
lxml
mypy
commands =
-mypy \
--strict \
--show-error-context \
--html-report {env:MYPYHTML}.py3.{envname} \
{posargs:{env:SSHAUDIT}}
[testenv:pylint]
deps =
mccabe
pylint
commands =
-pylint \
--rcfile tox.ini \
--load-plugins=pylint.extensions.bad_builtin \
--load-plugins=pylint.extensions.check_elif \
--load-plugins=pylint.extensions.mccabe \
{posargs:{env:SSHAUDIT}}
[testenv:flake8]
deps =
flake8
commands =
flake8 {posargs:{env:SSHAUDIT} {toxinidir}/setup.py {toxinidir}/test {toxinidir}/ssh-audit.py} --statistics
[testenv:vulture]
deps =
vulture
commands =
python -c "import sys; from subprocess import Popen, PIPE; \
a = ['vulture', '--min-confidence', '100'] + r'{posargs:{env:SSHAUDIT}}'.split(' '); \
o = Popen(a, shell=False, stdout=PIPE).communicate()[0]; \
l = [x for x in o.split(b'\n') if x and b'Unused import' not in x]; \
print(b'\n'.join(l).decode('utf-8')); \
sys.exit(1 if len(l) > 0 else 0)"
[pylint]
reports = no
#output-format = colorized
indent-string = " "
disable =
bad-continuation,
broad-except,
fixme,
invalid-name,
line-too-long,
missing-docstring,
mixed-indentation,
no-else-raise,
no-else-return,
too-complex,
too-many-boolean-expressions,
too-many-branches,
too-many-instance-attributes,
too-many-lines,
too-many-locals,
too-many-statements
max-complexity = 15
max-args = 8
max-locals = 20
max-returns = 6
max-branches = 15
max-statements = 60
max-parents = 7
max-attributes = 8
min-public-methods = 1
max-public-methods = 20
max-bool-expr = 5
max-nested-blocks = 6
max-line-length = 80
ignore-long-lines = ^\s*(#\s+type:\s+.*|[A-Z0-9_]+\s+=\s+.*|('.*':\s+)?\[.*\],?|assert\s+.*)$
max-module-lines = 2500
[flake8]
ignore =
E241, # multiple spaces after operator; should be kept for tabular data
E303, # too many blank lines
E501, # line too long
[pytest]
junit_family = xunit1
[coverage:paths]
source =
src
*/site-packages