From 09619e7d1c8f8f97d47d6d80750dadb2da7d7167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno=20i=20Caireta?= <inigo.moreno@tecnalia.com> Date: Tue, 27 Feb 2024 10:30:58 +0100 Subject: [PATCH] Extend flake8 to all files with a python shebang --- ci-templates/python.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ci-templates/python.yml b/ci-templates/python.yml index cdb6a09..4a593b6 100644 --- a/ci-templates/python.yml +++ b/ci-templates/python.yml @@ -2,14 +2,16 @@ .flake8_template: stage: build before_script: ${PYTHON_VERSION} -m pip -q install flake8 - script: ${PYTHON_VERSION} -m flake8 --max-line-length 120 --statistics --show-source . - + script: + - find . -type f -executable -exec awk ' /^#!.*python/{print FILENAME} {nextfile}' {} + > /tmp/shebang_python_files + - find . -type f -name "*.py" > /tmp/extension_python_files + - sort /tmp/extension_python_files /tmp/shebang_python_files | uniq | xargs ${PYTHON_VERSION} -m flake8 --max-line-length 120 --statistics --show-source .flake8_extended_template: + extends: .flake8_template stage: .post before_script: - ${PYTHON_VERSION} -m pip install flake8 flake8-isort flake8-builtins flake8-eradicate flake8-functions-names flake8-return flake8-functions - script: ${PYTHON_VERSION} -m flake8 --max-line-length 120 --statistics --show-source . allow_failure: true .security_template: -- GitLab