Skip to content

Commit b69baa8

Browse files
committed
DEV: Add pre-commit linting support
1 parent 850763f commit b69baa8

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

.github/workflows/build-and-test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ jobs:
3232
python-version: ${{ matrix.python-version }}
3333
allow-prereleases: true
3434

35+
- uses: tj-actions/changed-files@v36
36+
- uses: pre-commit/[email protected]
37+
with:
38+
extra_args: --files ${{ steps.changed-files.outputs.all_changed_files }}
39+
3540
- name: Install Dependencies
3641
run: |
3742
python3 -m pip install --upgrade pip

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: check-toml
6+
- id: check-yaml
7+
- id: end-of-file-fixer
8+
- id: mixed-line-ending
9+
args:
10+
- --fix=lf
11+
- id: requirements-txt-fixer
12+
- id: trailing-whitespace
13+
14+
- repo: https://github.com/MarcoGorelli/cython-lint
15+
rev: v0.15.0
16+
hooks:
17+
- id: cython-lint
18+
args:
19+
- --max-line-length=85
20+
- id: double-quote-cython-strings

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ cythonize:
99

1010
dev:
1111
pip install -r requirements-dev.txt
12+
pre-commit install --install-hooks
1213

1314
sdist:
1415
python -m build --sdist

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
-e .
22
cython==0.29.36
33
numpy==1.26.0
4+
pre-commit==3.4.0
45
pytest==7.4.0
56
pytest-cov==4.1.0

0 commit comments

Comments
 (0)