From 4b74594a29ac0d1dcb79ca23fcc5d8c1f72cb1ff Mon Sep 17 00:00:00 2001 From: Jakub Libosvar Date: Thu, 28 Aug 2025 16:09:17 +0000 Subject: [PATCH] pep8: Return ability to run pylint only on given patches This commit [1] removed ability to run pylint only on files that were modified by latest patches. This patch adds it back. [1] https://opendev.org/openstack/neutron/commit/be77ed3a813709eebb2659b5473b890b5978c743 Change-Id: Ic6cbe9c9639b976a46fb2858c10c9caf0c998bbf Signed-off-by: Jakub Libosvar --- TESTING.rst | 2 +- tools/coding-checks.sh | 6 +++--- tox.ini | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/TESTING.rst b/TESTING.rst index 412f2607b8f..d6344139287 100644 --- a/TESTING.rst +++ b/TESTING.rst @@ -449,7 +449,7 @@ to run. To restrict the pylint check to only the files altered by the latest patch changes:: - tox -e pep8 HEAD~1 + tox -e pep8 -- HEAD~1 To run only the unit tests:: diff --git a/tools/coding-checks.sh b/tools/coding-checks.sh index b81861abd4d..69ac0bfce20 100755 --- a/tools/coding-checks.sh +++ b/tools/coding-checks.sh @@ -28,7 +28,10 @@ process_options () { run_pylint () { local target="${scriptargs:-all}" + echo "Running pylint..." + if [ "$target" = "all" ]; then + echo "You can speed this up by running it on 'HEAD~[0-9]' (e.g. HEAD~1, this change only)..." files="neutron" else case "$target" in @@ -36,9 +39,6 @@ run_pylint () { *) echo "$target is an unrecognized basecommit"; exit 1;; esac fi - - echo "Running pylint..." - echo "You can speed this up by running it on 'HEAD~[0-9]' (e.g. HEAD~1, this change only)..." echo "" echo "Consider using the 'pre-commit' tool instead." echo "" diff --git a/tox.ini b/tox.ini index cb2d50fe79c..38a572d989b 100644 --- a/tox.ini +++ b/tox.ini @@ -143,10 +143,12 @@ deps = pre-commit~=4.0 # MIT commands = pre-commit run --all-files --show-diff-on-failure - pylint --rcfile=.pylintrc --output-format=colorized neutron + bash ./tools/coding-checks.sh --pylint '{posargs}' neutron-db-manage --config-file neutron/tests/etc/neutron.conf check_migration {[testenv:genconfig]commands} {[testenv:genpolicy]commands} +allowlist_externals = + bash [testenv:cover] description =