Linting in tox.ini: use variable for target dirs

Instead of providing a target directory for linting by each of the
tools use one variable which will be the source of truth about which
directories do we lint.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
This commit is contained in:
Martin Vrachev 2021-12-02 14:12:05 +02:00
parent 1ae6a22b8e
commit d697f73da2
2 changed files with 5 additions and 10 deletions

View file

@ -76,12 +76,6 @@ strict_equality = "True"
disallow_untyped_defs = "True"
disallow_untyped_calls = "True"
show_error_codes = "True"
files = [
"tuf/api/",
"tuf/ngclient",
"tuf/exceptions.py",
"examples/",
]
[[tool.mypy.overrides]]
module = [

View file

@ -38,17 +38,18 @@ commands =
[testenv:lint]
changedir = {toxinidir}
lint_dirs = tuf/api tuf/ngclient examples
commands =
# Use different configs for new (tuf/api/*) and legacy code
black --check --diff tuf/api tuf/ngclient examples
isort --check --diff tuf/api tuf/ngclient examples
pylint -j 0 tuf/api tuf/ngclient --rcfile=pyproject.toml examples
black --check --diff {[testenv:lint]lint_dirs}
isort --check --diff {[testenv:lint]lint_dirs}
pylint -j 0 --rcfile=pyproject.toml {[testenv:lint]lint_dirs}
# NOTE: Contrary to what the pylint docs suggest, ignoring full paths does
# work, unfortunately each subdirectory has to be ignored explicitly.
pylint -j 0 tuf --ignore=tuf/api,tuf/api/serialization,tuf/ngclient,tuf/ngclient/_internal
mypy
mypy {[testenv:lint]lint_dirs} tuf/exceptions.py
bandit -r tuf