From b9ebf85ffa4f1bb26009e7901a68274900c1b09d Mon Sep 17 00:00:00 2001 From: Michael Wagner Date: Mon, 29 Apr 2024 16:10:42 +0000 Subject: [PATCH 1/5] Refactor workflow --- .github/workflows/pre-commit.yaml | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index 3d616bb..f1b6fd2 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -10,29 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Setup python - uses: actions/setup-python@v4 - with: - python-version: 3.x - - - name: Install pre-commit - run: python -m pip install pre-commit isort flake8 black - shell: bash - - - name: Freeze dependencies - run: python -m pip freeze --local - shell: bash - - - name: Cache pre-commit environment - uses: actions/cache@v3 - with: - path: | - ~/.cache/pre-commit - ~/.cache/R - key: pre-commit-3-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml') }} - - - name: Run pre-commit - run: pre-commit run --show-diff-on-failure --color=always --all-files - shell: bash + - name: Run pre-commit checks + uses: ccao-data/actions/pre-commit@main From 10f18279d1af6e02543dd6a745c5ad5cce434da2 Mon Sep 17 00:00:00 2001 From: Michael Wagner Date: Mon, 29 Apr 2024 16:20:18 +0000 Subject: [PATCH 2/5] Re-work .pre-commit-config --- .pre-commit-config.yaml | 58 ++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cd738d8..095c9a5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,37 +1,31 @@ repos: -- repo: local + - repo: https://github.com/psf/black + rev: 23.7.0 hooks: + - id: black + language_version: python3 + types: [python] + files: '^(assesspy/|tests/)' - - id: black - name: black - entry: black - language: system - types: [ python ] - files: ^(assesspy/|tests/) - - - id: isort - name: isort - entry: isort - language: system - types: [ python ] + - repo: https://github.com/pycqa/isort + rev: 5.11.0 + hooks: + - id: isort + args: + - '--line-length=110' + - '--multi-line=3' + - '--force-grid-wrap=0' + - '--trailing-comma' + - '--use-parentheses' + - '--ensure-newline-before-comments' + types: [python] exclude: '.*/migrations/.*' - args: [ - '--line-length=110', - '--multi-line=3', - '--force-grid-wrap=0', - '--trailing-comma', - '--use-parentheses', - '--ensure-newline-before-comments', - ] - - id: flake8 - name: flake8 - entry: flake8 - language: system - types: [ python ] - files: ^(assesspy/|tests/) - args: [ - '--per-file-ignores= - assesspy/*:E501 - assesspy/__init__.py:F401' - ] + - repo: https://github.com/pycqa/flake8 + rev: 5.0.0 + hooks: + - id: flake8 + args: + - '--per-file-ignores=assesspy/*:E501 assesspy/__init__.py:F401' + types: [python] + files: '^(assesspy/|tests/)' From 40759a9cdae35518504d406ca04586d7e83a8610 Mon Sep 17 00:00:00 2001 From: Michael Wagner Date: Mon, 29 Apr 2024 16:27:28 +0000 Subject: [PATCH 3/5] Revert pre commit config --- .pre-commit-config.yaml | 58 +++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 095c9a5..21396e8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,31 +1,37 @@ repos: - - repo: https://github.com/psf/black - rev: 23.7.0 +- repo: local hooks: - - id: black - language_version: python3 - types: [python] - files: '^(assesspy/|tests/)' - - repo: https://github.com/pycqa/isort - rev: 5.11.0 - hooks: - - id: isort - args: - - '--line-length=110' - - '--multi-line=3' - - '--force-grid-wrap=0' - - '--trailing-comma' - - '--use-parentheses' - - '--ensure-newline-before-comments' - types: [python] + - id: black + name: black + entry: black + language: system + types: [ python ] + files: ^(assesspy/|tests/) + + - id: isort + name: isort + entry: isort + language: system + types: [ python ] exclude: '.*/migrations/.*' + args: [ + '--line-length=110', + '--multi-line=3', + '--force-grid-wrap=0', + '--trailing-comma', + '--use-parentheses', + '--ensure-newline-before-comments', + ] - - repo: https://github.com/pycqa/flake8 - rev: 5.0.0 - hooks: - - id: flake8 - args: - - '--per-file-ignores=assesspy/*:E501 assesspy/__init__.py:F401' - types: [python] - files: '^(assesspy/|tests/)' + - id: flake8 + name: flake8 + entry: flake8 + language: system + types: [ python ] + files: ^(assesspy/|tests/) + args: [ + '--per-file-ignores= + assesspy/*:E501 + assesspy/__init__.py:F401' + ] \ No newline at end of file From 3daeb31a27f4237d8d5e17aea9cc4bc7a373af3c Mon Sep 17 00:00:00 2001 From: Michael Wagner Date: Mon, 29 Apr 2024 17:41:01 +0000 Subject: [PATCH 4/5] Try different flake8 version --- .pre-commit-config.yaml | 58 ++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 21396e8..825ce32 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,37 +1,31 @@ repos: -- repo: local + - repo: https://github.com/psf/black + rev: 23.7.0 hooks: + - id: black + language_version: python3 + types: [python] + files: '^(assesspy/|tests/)' - - id: black - name: black - entry: black - language: system - types: [ python ] - files: ^(assesspy/|tests/) - - - id: isort - name: isort - entry: isort - language: system - types: [ python ] + - repo: https://github.com/pycqa/isort + rev: 5.11.0 + hooks: + - id: isort + args: + - '--line-length=110' + - '--multi-line=3' + - '--force-grid-wrap=0' + - '--trailing-comma' + - '--use-parentheses' + - '--ensure-newline-before-comments' + types: [python] exclude: '.*/migrations/.*' - args: [ - '--line-length=110', - '--multi-line=3', - '--force-grid-wrap=0', - '--trailing-comma', - '--use-parentheses', - '--ensure-newline-before-comments', - ] - - id: flake8 - name: flake8 - entry: flake8 - language: system - types: [ python ] - files: ^(assesspy/|tests/) - args: [ - '--per-file-ignores= - assesspy/*:E501 - assesspy/__init__.py:F401' - ] \ No newline at end of file + - repo: https://github.com/pycqa/flake8 + rev: 7.0.0 + hooks: + - id: flake8 + args: + - '--per-file-ignores=assesspy/*:E501 assesspy/__init__.py:F401' + types: [python] + files: '^(assesspy/|tests/)' From b3a3874a31ab62041363fda3a5b447090cb74f1e Mon Sep 17 00:00:00 2001 From: Michael Wagner Date: Mon, 29 Apr 2024 17:46:19 +0000 Subject: [PATCH 5/5] Try changing isort version --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 825ce32..2d504f1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: files: '^(assesspy/|tests/)' - repo: https://github.com/pycqa/isort - rev: 5.11.0 + rev: 5.12.0 hooks: - id: isort args: