|
| 1 | +[tox] |
| 2 | +envlist = py26,py27,py33,py34,py35,py36,py37,jython,pypy,pypy3,cov,type,lint |
| 3 | +skipsdist = true |
| 4 | +skip_missing_interpreters = true |
| 5 | + |
| 6 | +[testenv] |
| 7 | +deps = |
| 8 | + pytest==3.0.7 |
| 9 | + coverage==4.3.4 |
| 10 | + colorama==0.3.7 |
| 11 | +setenv = |
| 12 | + SSHAUDIT = {toxinidir}/ssh-audit.py |
| 13 | + COVERAGE_FILE = {toxinidir}/.coverage.{envname} |
| 14 | +commands = |
| 15 | + coverage run --source ssh-audit -m -- pytest -v {posargs:test} |
| 16 | + coverage report --show-missing |
| 17 | + coverage html -d {toxinidir}/html/coverage.{envname} |
| 18 | + |
| 19 | +[testenv:cov] |
| 20 | +deps = |
| 21 | + coverage==4.3.4 |
| 22 | +setenv = |
| 23 | + COVERAGE_FILE = {toxinidir}/.coverage |
| 24 | +commands = |
| 25 | + coverage erase |
| 26 | + coverage combine |
| 27 | + coverage report --show-missing |
| 28 | + coverage html -d {toxinidir}/html/coverage |
| 29 | +ignore_outcome = true |
| 30 | + |
| 31 | +[testenv:mypy] |
| 32 | +basepython = |
| 33 | + {env:MYPYBASE:python3.5} |
| 34 | +deps = |
| 35 | + colorama==0.3.7 |
| 36 | + mypy==0.501 |
| 37 | + lxml==3.7.3 |
| 38 | +setenv = |
| 39 | + {[testenv]setenv} |
| 40 | + MYPYPATH = {toxinidir}/test/stubs |
| 41 | + MYPYHTML = {toxinidir}/html/mypy |
| 42 | +commands = |
| 43 | + mypy \ |
| 44 | + --show-error-context \ |
| 45 | + --config-file {toxinidir}/tox.ini \ |
| 46 | + --html-report {env:MYPYHTML}.py3 \ |
| 47 | + {posargs:{env:SSHAUDIT}} |
| 48 | + mypy \ |
| 49 | + -2 \ |
| 50 | + --no-warn-incomplete-stub \ |
| 51 | + --show-error-context \ |
| 52 | + --config-file {toxinidir}/tox.ini \ |
| 53 | + --html-report {env:MYPYHTML}.py2 \ |
| 54 | + {posargs:{env:SSHAUDIT}} |
| 55 | + |
| 56 | +[testenv:pylint] |
| 57 | +deps = |
| 58 | + mccabe |
| 59 | + pylint |
| 60 | +commands = |
| 61 | + pylint \ |
| 62 | + --rcfile tox.ini \ |
| 63 | + --load-plugins=pylint.extensions.bad_builtin \ |
| 64 | + --load-plugins=pylint.extensions.check_elif \ |
| 65 | + --load-plugins=pylint.extensions.mccabe \ |
| 66 | + {posargs:{env:SSHAUDIT}} |
| 67 | + |
| 68 | +[testenv:flake8] |
| 69 | +deps = |
| 70 | + flake8 |
| 71 | +commands = |
| 72 | + flake8 {posargs:{env:SSHAUDIT}} |
| 73 | + |
| 74 | +[testenv:vulture] |
| 75 | +deps = vulture |
| 76 | +commands = |
| 77 | + python -c "import sys; from subprocess import Popen, PIPE; \ |
| 78 | + a = ['vulture'] + r'{posargs:{env:SSHAUDIT}}'.split(' '); \ |
| 79 | + o = Popen(a, shell=False, stdout=PIPE).communicate()[0]; \ |
| 80 | + l = [x for x in o.split('\n') if x and 'Unused import' not in x]; \ |
| 81 | + print('\n'.join(l)); \ |
| 82 | + sys.exit(1 if len(l) > 0 else 0)" |
| 83 | + |
| 84 | +[testenv:type] |
| 85 | +basepython = |
| 86 | + {[testenv:mypy]basepython} |
| 87 | +deps = |
| 88 | + {[testenv:mypy]deps} |
| 89 | +setenv = |
| 90 | + {[testenv:mypy]setenv} |
| 91 | +commands = |
| 92 | + {[testenv:mypy]commands} |
| 93 | +ignore_outcome = true |
| 94 | + |
| 95 | +[testenv:lint] |
| 96 | +deps = |
| 97 | + {[testenv:pylint]deps} |
| 98 | + {[testenv:flake8]deps} |
| 99 | + {[testenv:vulture]deps} |
| 100 | +commands = |
| 101 | + {[testenv:pylint]commands} |
| 102 | + {[testenv:flake8]commands} |
| 103 | + {[testenv:vulture]commands} |
| 104 | +ignore_outcome = true |
| 105 | + |
| 106 | + |
| 107 | +[mypy] |
| 108 | +ignore_missing_imports = False |
| 109 | +follow_imports = error |
| 110 | +disallow_untyped_calls = True |
| 111 | +disallow_untyped_defs = True |
| 112 | +check_untyped_defs = True |
| 113 | +disallow_subclassing_any = True |
| 114 | +warn_incomplete_stub = True |
| 115 | +warn_redundant_casts = True |
| 116 | +warn_return_any = True |
| 117 | +warn_unused_ignores = True |
| 118 | +strict_optional = True |
| 119 | +#strict_boolean = False |
| 120 | + |
| 121 | +[pylint] |
| 122 | +reports = no |
| 123 | +#output-format = colorized |
| 124 | +indent-string = \t |
| 125 | +disable = locally-disabled, bad-continuation, multiple-imports, invalid-name, trailing-whitespace, missing-docstring |
| 126 | +max-complexity = 15 |
| 127 | +max-args = 8 |
| 128 | +max-locals = 20 |
| 129 | +max-returns = 6 |
| 130 | +max-branches = 15 |
| 131 | +max-statements = 60 |
| 132 | +max-parents = 7 |
| 133 | +max-attributes = 8 |
| 134 | +min-public-methods = 1 |
| 135 | +max-public-methods = 20 |
| 136 | +max-bool-expr = 5 |
| 137 | +max-nested-blocks = 6 |
| 138 | +max-line-length = 80 |
| 139 | +ignore-long-lines = ^\s*(#\s+type:\s+.*|[A-Z0-9_]+\s+=\s+.*|('.*':\s+)?\[.*\],?)$ |
| 140 | +max-module-lines = 2500 |
| 141 | + |
| 142 | +[flake8] |
| 143 | +ignore = |
| 144 | + # indentation contains tabs |
| 145 | + W191, |
| 146 | + # blank line contains whitespace |
| 147 | + W293, |
| 148 | + # indentation contains mixed spaces and tabs |
| 149 | + E101, |
| 150 | + # multiple spaces before operator |
| 151 | + E221, |
| 152 | + # multiple spaces after operator |
| 153 | + E241, |
| 154 | + # multiple imports on one line |
| 155 | + E401, |
| 156 | + # line too long |
| 157 | + E501, |
| 158 | + # module imported but unused |
| 159 | + F401, |
| 160 | + # undefined name |
| 161 | + F821 |
0 commit comments