[tox] envlist = linters,pylint minversion = 4 skipsdist = True stxdir = {toxinidir}/.. # Cap setuptools via virtualenv to prevent compatibility issue with pb5 5.5.0 requires = virtualenv<20.24.0 [testenv] basepython = python3 install_command = pip install -U \ -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 = bash [testenv:linters] # Ignore errors in included vendor code that we don't control. #bashate ignore #E006 Line too long #E041 Arithmetic expansion using $[ is deprecated for $(( #E042 local declaration hides errors #E043 Arithmetic compound has inconsistent return semantics #E044 Use [[ for non-POSIX comparisions commands = bash -c "find {toxinidir} \ -path {toxinidir}/kubernetes/plugins/isolcpus-device-plugin/files/vendor -prune -o \ -path {toxinidir}/tools/kexec-tools/files -prune -o \ -not \( -type d -name .?\* -prune \) \ -type f \ -not -name \*~ \ -not -name \*.md \ -name \*.sh \ -print0 | xargs -n 1 -0 bashate -v \ -i E006,E041,E042,E043,E044 -e E*" bash -c "find {toxinidir} \ \( -path {toxinidir}/.tox \) -a -prune \ -o -type f -name '*.yaml' \ -print0 | xargs -0 yamllint" [testenv:pep8] usedevelop = False skip_install = True deps = hacking flake8-bugbear<=19.3.0 flake8<3.8.3 commands = flake8 [testenv:pylint] deps = -r{toxinidir}/test-requirements.txt -e{[tox]stxdir}/config/sysinv/cgts-client/cgts-client pylint # Currently only one python module with a setup.py file commands = pylint --rcfile=./.pylintrc \ tools/storage-topology/storage-topology/storage_topology [testenv:venv] commands = {posargs} [testenv:docs] 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 reno [testenv:newnote] # Re-use the releasenotes venv envdir = {toxworkdir}/releasenotes deps = -r{toxinidir}/doc/requirements.txt commands = reno new {posargs} [testenv:functional] allowlist_externals = cat commands = cat /etc/group [flake8] # E series are pep8 # E265 block comment should start with '# ' # E266 too many leading '#' for block comment # E402 module level import not at top of file # E501 line too long > 80 # E722 do not use bare except' # E741 ambiguous variable name # F series # F504 '...' % ... has unused named argument(s): # F509 '...' % ... has unsupported format character ',' # F841 local variable 'e' is assigned to but never used # H series are hacking # H101: Use TODO(NAME) # H102 is apache license # H104: File contains nothing but comments # H201: no 'except:' at least use 'except Exception:' # H238: old style class declaration, use new style # H306: imports not in alphabetical order # W series # W291 trailing whitespace # W391 blank line at end of file # W503 line break before binary operator # W504 line break after binary operator # B series are from bugbear # B001 Do not use bare `except: # B007 Loop control variable 'cpu' not used within the loop body. # B009 Do not call getattr with a constant attribute value # B010 Do not call setattr with a constant attribute value # F series # F401 'module' imported but unused ignore = E265,E266,E402,E501,E722,E741 F504,F509,F841, H101,H102,H104,H201,H238,H306, W291,W391,W503,W504 B001,B007,B009,B010, F401