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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cd738d8..2d504f1 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.12.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: 7.0.0 + hooks: + - id: flake8 + args: + - '--per-file-ignores=assesspy/*:E501 assesspy/__init__.py:F401' + types: [python] + files: '^(assesspy/|tests/)'