-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
152 lines (135 loc) · 3.95 KB
/
.pre-commit-config.yaml
File metadata and controls
152 lines (135 loc) · 3.95 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# To run all pre-commit checks, use:
#
# uvx prek run -a
#
# To install pre-commit hooks that run every time you commit:
#
# uv tool install prek
# prek install
#
ci:
autoupdate_commit_msg: "⬆️🪝 update pre-commit hooks"
autoupdate_schedule: quarterly
autofix_commit_msg: "🎨 pre-commit fixes"
skip: [cargo-fmt, ty-check]
repos:
# Priority 0: Fast validation and independent fixers
## Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-merge-conflict
priority: 0
- id: end-of-file-fixer
priority: 1
- id: trailing-whitespace
priority: 1
## Check the pyproject.toml file
- repo: https://github.com/henryiii/validate-pyproject-schema-store
rev: 2026.03.15
hooks:
- id: validate-pyproject
priority: 0
## Check JSON schemata
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.0
hooks:
- id: check-github-workflows
priority: 0
- id: check-readthedocs
priority: 0
## Catch common capitalization mistakes
- repo: local
hooks:
- id: disallow-caps
name: Disallow improper capitalization
language: pygrep
entry: '\b(?:Numpy|Github|PyTest|Tum)\b'
exclude: .pre-commit-config.yaml
priority: 0
## Check for spelling
- repo: https://github.com/adhtruong/mirrors-typos
rev: v1.44.0
hooks:
- id: typos
priority: 0
## Check best practices for scientific Python code
- repo: https://github.com/scientific-python/cookie
rev: 2026.03.02
hooks:
- id: sp-repo-review
additional_dependencies: ["repo-review[cli]"]
priority: 0
## Ensure uv lock file is up-to-date
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.10.12
hooks:
- id: uv-lock
priority: 0
## Tidy up BibTeX files
- repo: https://github.com/FlamingTempura/bibtex-tidy
rev: v1.14.0
hooks:
- id: bibtex-tidy
args:
[
"--align=20",
"--curly",
"--months",
"--blank-lines",
"--sort",
"--strip-enclosing-braces",
"--sort-fields",
"--trailing-commas",
"--remove-empty-fields",
]
priority: 0
# Priority 1: Second-pass fixers
## Format Rust files
- repo: local
hooks:
- id: cargo-fmt
name: cargo fmt
entry: cargo fmt
language: unsupported
types: [rust]
pass_filenames: false
priority: 1
## Format configuration files with prettier
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.8.1
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
exclude: ^(gui/index.html|gui/assets/sw.js)
priority: 1
## Python linting using ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.7
hooks:
- id: ruff-format
priority: 1
- id: ruff-check
require_serial: true
priority: 2
# Priority 2+: Final checks and fixers
## Also run Black on examples in the documentation (needs to run after ruff format)
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.20.0
hooks:
- id: blacken-docs
language: python
additional_dependencies: [black==26.*]
priority: 2
## Static type checking using ty (needs to run after lockfile update/ruff format, and ruff lint)
- repo: local
hooks:
- id: ty-check
name: ty check
entry: uvx python -c "import subprocess; import sys; r = subprocess.run(['uv', 'sync', '--no-install-project', '--inexact']); sys.exit(r.returncode or subprocess.run(['uv', 'run', '--no-sync', 'ty', 'check']).returncode)"
language: unsupported
require_serial: true
types_or: [python, pyi, jupyter]
exclude: ^(docs/)
pass_filenames: false
priority: 3