Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor pre-commit using composite action. #18

Merged
merged 6 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 3 additions & 25 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
58 changes: 26 additions & 32 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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/)'
Loading