From ababf7fe35c2cbb053484894020c9b10c52c744b Mon Sep 17 00:00:00 2001 From: SKairinos Date: Fri, 12 Apr 2024 12:50:52 +0100 Subject: [PATCH] lint non-test files and test files differently --- .github/workflows/test-python-code.yaml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-python-code.yaml b/.github/workflows/test-python-code.yaml index f1bafeea..15fdb920 100644 --- a/.github/workflows/test-python-code.yaml +++ b/.github/workflows/test-python-code.yaml @@ -59,7 +59,28 @@ jobs: - name: 🔎 Check Static Code working-directory: ${{ inputs.working-directory }} - run: if ! pipenv run pylint --rcfile=${{ env.PYPROJECT_TOML }} $(git ls-files '${{ inputs.source-path }}/*.py'); then exit 1; fi + run: | + if ! pipenv run pylint --rcfile=${{ env.PYPROJECT_TOML }} $( + git ls-files \ + '${{ inputs.source-path }}/*.py' \ + '${{ inputs.source-path }}/**/*.py' \ + ':!${{ inputs.source-path }}/test_*.py' \ + ':!${{ inputs.source-path }}/**/test_*.py' \ + ':!${{ inputs.source-path }}/*_test.py' \ + ':!${{ inputs.source-path }}/**/*_test.py' + ) + then exit 1 + fi + + if ! pipenv run pylint --rcfile=${{ env.PYPROJECT_TOML }} --disable=duplicate-code $( + git ls-files \ + '${{ inputs.source-path }}/test_*.py' \ + '${{ inputs.source-path }}/**/test_*.py' \ + '${{ inputs.source-path }}/*_test.py' \ + '${{ inputs.source-path }}/**/*_test.py' + ) + then exit 1 + fi - name: 🔎 Check Django Migrations if: inputs.check-django-migrations