summaryrefslogtreecommitdiffstats
path: root/tox.ini
blob: 4b6d8d0df261eae86b95f0bd9d233f9d316e8b9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
[tox]
envlist = 
	py{py3}-{test,pylint,flake8,vulture}
	py{36,37,38,39}-{test,mypy,pylint,flake8,vulture}
	cov
skip_missing_interpreters = true

[testenv]
deps = 
	test: pytest<6.0
	test,cov: {[testenv:cov]deps}
	test,py{36,37,38,39}-{type,mypy}: colorama
	py{36,37,38,39}-{type,mypy}: {[testenv:mypy]deps}
	py{py3,36,37,38,39}-{lint,pylint},lint: {[testenv:pylint]deps}
	py{py3,36,37,38,39}-{lint,flake8},lint: {[testenv:flake8]deps}
	py{py3,36,37,38,39}-{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{36,37,38,39}-{type,mypy}: {[testenv:mypy]commands}
	py{py3,36,37,38,39}-{lint,pylint},lint: {[testenv:pylint]commands}
	py{py3,36,37,38,39}-{lint,flake8},lint: {[testenv:flake8]commands}
	py{py3,36,37,38,39}-{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,
        duplicate-code,
        fixme,
        invalid-name,
        line-too-long,
        missing-docstring,
        mixed-indentation,
        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,
        unsubscriptable-object  # This seems to be a local issue on the maintainer's machine only.  Could be removed, perhaps, in Jan 2021.
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