diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:07:52 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:07:52 +0000 |
commit | f0f453c916e279980df981c1e1dee0d167dc124e (patch) | |
tree | d09973c9f173820ade2dc814467d3e57df8a042d /tox.ini | |
parent | Initial commit. (diff) | |
download | ssh-audit-upstream.tar.xz ssh-audit-upstream.zip |
Adding upstream version 3.1.0.upstream/3.1.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tox.ini')
-rw-r--r-- | tox.ini | 139 |
1 files changed, 139 insertions, 0 deletions
@@ -0,0 +1,139 @@ +[tox] +envlist = + py{py3}-{test,pylint,flake8,vulture} + py{38,39,310,311,312}-{test,mypy,pylint,flake8,vulture} + cov +skip_missing_interpreters = true + +[testenv] +deps = + test: pytest + test,cov: {[testenv:cov]deps} + test,py{38,39,310,311,312}-{type,mypy}: colorama + py{38,39,310,311,312}-{type,mypy}: {[testenv:mypy]deps} + py{py3,38,39,310,311,312}-{lint,pylint},lint: {[testenv:pylint]deps} + py{py3,38,39,310,311,312}-{lint,flake8},lint: {[testenv:flake8]deps} + py{py3,38,39,310,311,312}-{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{38,39,310,311,312}-{type,mypy}: {[testenv:mypy]commands} + py{py3,38,39,310,311,312}-{lint,pylint},lint: {[testenv:pylint]commands} + py{py3,38,39,310,311,312}-{lint,flake8},lint: {[testenv:flake8]commands} + py{py3,38,39,310,311,312}-{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 = + broad-except, + duplicate-code, + fixme, + invalid-name, + line-too-long, + missing-docstring, + no-else-raise, + no-else-return, + super-with-arguments, # Can be re-factored, at some point. + too-complex, + too-many-boolean-expressions, + too-many-branches, + too-many-instance-attributes, + too-many-lines, + too-many-locals, + too-many-statements, + consider-using-f-string +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] +# E241 = multiple spaces after operator; should be kept for tabular data +# E303 = too many blank lines +# E501 = line too long +ignore = E241, E303, E501 + +[pytest] +junit_family = xunit1 + +[coverage:paths] +source = + src + */site-packages |