-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
34 lines (34 loc) · 1.36 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
34 lines (34 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Pre-commit hooks mirroring the CI lint job (.github/workflows/ci.yml).
#
# Local hooks call `uv run ruff` rather than pinning a separate ruff via
# astral-sh/ruff-pre-commit, so the hook, CI, and the project's dev
# dependency all resolve to the SAME ruff — no version drift, which is the
# whole point of catching `ruff format` before it reaches CI.
#
# One-time setup (after `uv sync --extra dev`):
# uv run pre-commit install
#
# Run against everything on demand:
# uv run pre-commit run --all-files
#
# `--frozen` is load-bearing, not cosmetic. Without it, plain `uv run` re-locks
# `uv.lock` on the way to invoking ruff. During a `bump-my-version bump` commit
# the project version has just changed, so that re-lock rewrites uv.lock mid-hook
# — and pre-commit, which diffs the whole worktree around each hook, reports
# "files were modified by this hook" against ruff-format even though ruff itself
# changed nothing. `--frozen` uses the lockfile as-is and never writes it.
repos:
- repo: local
hooks:
- id: ruff-format
name: ruff format
entry: uv run --frozen ruff format
language: system
types_or: [python, pyi]
require_serial: true
- id: ruff-check
name: ruff check
entry: uv run --frozen ruff check --fix
language: system
types_or: [python, pyi]
require_serial: true