-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
80 lines (72 loc) · 2.58 KB
/
.pre-commit-config.yaml
File metadata and controls
80 lines (72 loc) · 2.58 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# SPDX-FileCopyrightText: 2026 PythonWoods <dev@pythonwoods.dev>
# SPDX-License-Identifier: Apache-2.0
# Segregate stage execution: linters run at commit-time only.
# Any pre-push orchestrator must declare `stages: [pre-push]` explicitly.
default_stages: [pre-commit]
repos:
# 1. Generic file hygiene
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--unsafe]
- id: check-json
- id: check-toml
- id: check-added-large-files
- id: check-merge-conflict
- id: check-case-conflict
- id: mixed-line-ending
# 2. Markdown linting
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: f295829140d25717bc79368d3f966fc1f67a824f # v0.41.0
hooks:
- id: markdownlint
args: ["--fix"]
# 3. Ruff (linting & formatting)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 25a8c8da6c24a3b9a1a536e2674683dd0eead5d6 # v0.11.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
exclude: ^examples/
- id: ruff-format
exclude: ^examples/
# 4. Purge __pycache__ before REUSE — bytecode in untracked dirs fails the check
- repo: local
hooks:
- id: clean-pycache
name: Clean __pycache__ before REUSE lint
entry: bash -c "find . -path './.git' -prune -o -name '__pycache__' -type d -print -exec rm -rf {} + 2>/dev/null || true"
language: system
pass_filenames: false
always_run: true
# 5. REUSE/SPDX license compliance
- repo: https://github.com/fsfe/reuse-tool
rev: 9fabf9eb815a57aac116b435e8346c200cdb8604 # v6.2.0
hooks:
- id: reuse
# 6. Local: type checking
- repo: local
hooks:
- id: mypy
name: Type Checking (mypy)
# language: system + uv run → uv reads pyproject.toml and installs all
# [project.dependencies] including google-re2. No additional_dependencies
# needed here (that's only for mirrors-mypy repo hooks that run in
# isolated virtualenvs outside the project's uv-managed environment).
entry: uv run mypy src/
language: system
types: [python]
pass_filenames: false
# 7. Final Guard — score gate + badge freshness + full audit (pre-push only)
- repo: local
hooks:
- id: just-verify
name: Final Guard (just verify)
entry: just verify
language: system
stages: [pre-push]
pass_filenames: false
always_run: true