From d697f73da219db8460414afbcf9b450ff3e0a2eb Mon Sep 17 00:00:00 2001 From: Martin Vrachev Date: Thu, 2 Dec 2021 14:12:05 +0200 Subject: [PATCH] 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 --- pyproject.toml | 6 ------ tox.ini | 9 +++++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index db4dd914..e80efb4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = [ diff --git a/tox.ini b/tox.ini index f7c891e3..443cc9b7 100644 --- a/tox.ini +++ b/tox.ini @@ -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