Skip to content

Commit c9f7d14

Browse files
authored
chore: Use local ruff and mypy for pre-commit checks (#547)
Ensures that the checks run by pre-commit are the same as the ones run in CI, and the `ruff` and `mypy` versions are always controlled by `pyproject.toml`. Before, we used pre-commit actions with their own versions that needed to be updated separately and tended to get out of date.
1 parent 8ee34e6 commit c9f7d14

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

.pre-commit-config.yaml

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,36 @@ repos:
3232
- id: check-docstring-first
3333
- id: debug-statements
3434

35-
- repo: https://github.com/astral-sh/ruff-pre-commit
36-
rev: v0.3.0
37-
hooks:
38-
- id: ruff
39-
args: [--fix, --exit-non-zero-on-fix]
40-
- id: ruff-format
41-
42-
- repo: https://github.com/pre-commit/mirrors-mypy
43-
rev: v1.9.0
44-
hooks:
45-
- id: mypy
46-
additional_dependencies: [pydantic]
47-
4835
- repo: local
4936
hooks:
37+
- id: poetry-install
38+
name: sync poetry deps
39+
description: Ensure development tools are installed.
40+
entry: poetry install --sync
41+
language: system
42+
files: poetry.lock
43+
pass_filenames: false
44+
- id: ruff-format
45+
name: ruff format
46+
description: Format python code with `ruff`.
47+
entry: poetry run ruff format
48+
language: system
49+
files: \.py$
50+
pass_filenames: false
51+
- id: ruff-check
52+
name: ruff
53+
description: Check python code with `ruff`.
54+
entry: poetry run ruff check --fix --exit-non-zero-on-fix
55+
language: system
56+
files: \.py$
57+
pass_filenames: false
58+
- id: mypy-check
59+
name: mypy
60+
description: Check python code with `mypy`.
61+
entry: poetry run mypy .
62+
language: system
63+
files: \.py$
64+
pass_filenames: false
5065
- id: cargo-fmt
5166
name: cargo format
5267
description: Format rust code with `cargo fmt`.

0 commit comments

Comments
 (0)