[tox] envlist = linters,pep8,pylint minversion = 2.3 skipsdist = True [testenv] basepython = python3 install_command = pip install \ -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \ {opts} {packages} setenv = VIRTUAL_ENV={envdir} OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 deps = -r{toxinidir}/test-requirements.txt allowlist_externals = reno [testenv:bashate] allowlist_externals = bash commands = bash -c "find {toxinidir} \ -not \( -type d -name .?\* -prune \) \ -type f \ -not -name \*~ \ -not -name \*.md \ \( \ -name \*.sh \ -or -not -wholename \*/devstack/files/\* \ -wholename \*/devstack/\* \ \) \ -print0 | xargs -r -n 1 -0 bashate -v -e E* -i E006" [testenv:yamllint] allowlist_externals = bash commands = bash -c "find {toxinidir} \ \( -name .tox -prune \) \ -o -type f -name '*.yaml' \ -print0 | xargs -0 yamllint" [testenv:linters] allowlist_externals = bash commands = {[testenv:bashate]commands} {[testenv:yamllint]commands} [testenv:pylint] deps = {[testenv]deps} eventlet httplib2 iso8601 jsonpatch keystonemiddleware kombu mysqlclient oslo.config pecan prettytable psutil sqlalchemy sqlalchemy-migrate wsme pylint commands = pylint --rcfile=./pylint.rc --extension-pkg-whitelist=greenlet \ ./service-mgmt-api/sm-api/sm_api/ \ ./service-mgmt-tools/sm-tools/sm_tools/ \ ./service-mgmt-client/sm-client/sm_client/ [flake8] # The following are being suppressed for now # E402 module level import not at top of file # - hacking codes - # H102: license header not found # H104: File contains nothing but comments # H105: Don't use author tags # H306: imports not in alphabetical order # H401: docstring should not start with a space # H403: multi line docstrings should end on a new line # H404: multi line docstring should start without a leading new line # H405: multi line docstring summary not separated with an empty line # H501: Do not use locals() for string formatting # W are warnings # W504 W504 line break after binary operator # W605 invalid escape sequence # - errors - # E741 ambiguous variable name # F811 redefinition of unused '' from line # F821 undefined name 'e' # F841 local variable # F901 'raise NotImplemented' should be 'raise NotImplementedError' # - bugbear - # B008 Do not perform calls in argument defaults. The call is performed only once at function definition time. # B009 Do not call getattr with a constant attribute value, it is not any safer than normal property access. # B014 Redundant exception types ignore= E402, H102,H104,H105,H106,H306,H401,H403,H404,H405,H501, W504,W605, E741, F811,F821,F841,F901, B008,B009,B014 # Enable checks which are off by default # H106 Don’t put vim configuration in source files (off by default). SHOULD BE ENABLED. # H203 Use assertIs(Not)None to check for None (off by default). # H904 Delay string interpolations at logging calls (off by default). SHOULD BE ENABLED. enable-extensions = H203 max-line-length = 110 [testenv:pep8] usedevelop = False skip_install = True deps = -r{toxinidir}/test-requirements.txt flake8-bugbear<23.2.13 commands = flake8 [testenv:venv] commands = {posargs} [testenv:docs] install_command = pip install -U {opts} {packages} deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf doc/build sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html allowlist_externals = rm [testenv:releasenotes] deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf releasenotes/build sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html allowlist_externals = rm [testenv:newnote] # Re-use the releasenotes venv install_command = pip install -U {opts} {packages} envdir = {toxworkdir}/releasenotes deps = -r{toxinidir}/doc/requirements.txt commands = reno new {posargs} [testenv:api-ref] install_command = pip install -U {opts} {packages} deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf api-ref/build sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html allowlist_externals = rm [bandit] # B324: hashlib # B411: blacklist Using xmlrpclib skips = B324,B411 [testenv:bandit] description = Bandit code scan for *.py files under config folder deps = -r{toxinidir}/test-requirements.txt commands = bandit --ini tox.ini -r {toxinidir}/ -x '**/.tox/**',**/.eggs/** -lll [testenv:bindep] # Do not install any requirements. We want this to be fast and work even if # system dependencies are missing, since it's used to tell you what system # dependencies are missing! This also means that bindep must be installed # separately, outside of the requirements files. skip_install = True deps = bindep commands = bindep test