From 31afc004bc034f3170247d4c7ccd3a7cc0d32551 Mon Sep 17 00:00:00 2001 From: Stanislav Levin Date: Thu, 19 Aug 2021 12:55:33 +0300 Subject: [PATCH] pycodestyle: Check *.in Python files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Many of IPA Python scripts are shebang configurable scripts and have special suffix '.in' for that. Pycodestyle by default check only '*.py' files [0]. [0]: https://pycodestyle.pycqa.org/en/latest/intro.html Fixes: https://pagure.io/freeipa/issue/8961 Signed-off-by: Stanislav Levin Reviewed-By: Rob Crittenden Reviewed-By: Florence Blanc-Renaud Reviewed-By: François Cami --- Makefile.am | 6 ++++-- tox.ini | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index abeaca7ed..64fce4ad3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -230,6 +230,8 @@ fasttest: $(GENERATED_PYTHON_FILES) ipasetup.py --ignore $(abspath $(top_srcdir))/ipatests/test_xmlrpc fastcodestyle: $(GENERATED_PYTHON_FILES) ipasetup.py + @ # keep Python files in sync to pycodestyle configuration in + @ # tox.ini(filename=) @echo "Fast code style checking with $(PYTHON) from branch '$(GIT_BRANCH)'" @MERGEBASE=$$(git merge-base --fork-point $(GIT_BRANCH)); \ @@ -250,8 +252,8 @@ fastcodestyle: $(GENERATED_PYTHON_FILES) ipasetup.py echo -e "Fast code style checking for files:\n$${FILES}\n"; \ echo "pycodestyle"; \ echo "-----------"; \ - git diff -U0 $${MERGEBASE} | \ - $(PYTHON) -m pycodestyle --diff || exit $$?; \ + git diff -U0 $${MERGEBASE} -- $${FILES} | \ + $(PYTHON) -m pycodestyle -v --diff || exit $$?; \ else \ echo "No modified Python files found"; \ fi diff --git a/tox.ini b/tox.ini index 9eebd9b8d..38d1b5a38 100644 --- a/tox.ini +++ b/tox.ini @@ -59,6 +59,7 @@ ignore = E203, E402, E231, W503, E731, E741 max-line-length = 80 # exclude auto-generated remote plugins exclude=.git,.venv,build,_build,rpmbuild,2_49,2_114,2_156,2_164 +filename=*.py,*.in [pytest] addopts = -ra -v