-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
235 lines (220 loc) · 6.52 KB
/
.pre-commit-config.yaml
File metadata and controls
235 lines (220 loc) · 6.52 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# pre-commit install
# pre-commit run --all-files
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
ci:
autoupdate_commit_msg: "chore(deps): update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"
autoupdate_schedule: "quarterly"
skip:
- uv-lock
- pip-compile
default_install_hook_types:
- pre-commit
- commit-msg
repos:
# * meta hooks
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
# * sync dependencies
- repo: https://github.com/wpk-nist-gov/sync-pre-commit-hooks
rev: v0.5.1
hooks:
- id: forbidden-files
- id: sync-pre-commit-deps
- id: sync-uv-build-deps
- id: sync-uv-dependency-groups
# * Top level
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
exclude: ^uv[.]lock|.*\.ipynb
- id: check-case-conflict
- id: check-merge-conflict
args: [--assume-in-merge]
- id: check-symlinks
exclude: SRS_data$|SWF_Adsorption_data$
- id: check-yaml
- id: check-json
- id: check-toml
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
# * toml/pyproject.toml
# ** format
- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo-format
# exclude: (^|/)pyproject\.toml$
- id: taplo-lint
args: ["--no-schema"]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.21.1
hooks:
- id: pyproject-fmt
# ** validate (schema-store)
- repo: https://github.com/henryiii/validate-pyproject-schema-store
rev: 2026.04.21
hooks:
- id: validate-pyproject
name: validate-pyproject-schema-store
stages: [manual]
# ** repo review
- repo: https://github.com/scientific-python/cookie
rev: 2026.04.04
hooks:
- id: sp-repo-review
stages: [manual]
# * Prettier
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.8.3
hooks:
- id: prettier
alias: markdownlint
stages: [pre-commit, manual]
args:
- "--cache"
- "--cache-location=.prettier_cache/cache"
# * Markdown
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.22.1
hooks:
- id: markdownlint-cli2
alias: markdownlint
args: [--style, prettier]
# Just
- repo: https://github.com/wpk-nist-gov/just-pre-commit
rev: v1.50.0
hooks:
- id: justfile-format
# * Linting
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.11
hooks:
- id: ruff-check
alias: ruff
args: [--fix, --show-fixes]
types_or: &ruff_types [python, pyi, jupyter, markdown]
- id: ruff-format
alias: ruff
types_or: *ruff_types
# * Spelling
# ** typos
- repo: https://github.com/adhtruong/mirrors-typos
rev: v1.45.1
hooks:
- id: typos
exclude_types: [jupyter]
exclude: ^uv[.]lock$|^requirements|^\.copier-answers\.ya?ml$
# * Dependencies
# ** pyproject2conda
- repo: https://github.com/usnistgov/pyproject2conda
rev: v0.22.1
hooks:
- id: pyproject2conda-project
alias: requirements
args:
- "--custom-command=prek run pyproject2conda-project --all-files"
# ** uv
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.11.7
hooks:
- id: uv-lock
alias: requirements
args: [--locked]
- id: pip-compile
alias: requirements
entry: python tools/requirements_lock.py
pass_filenames: true
files: ^requirements/[^/]*\.txt$
# * Commit message
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.13.10
hooks:
- id: commitizen
stages: [commit-msg]
# * Actions
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.1
hooks:
- id: check-github-workflows
alias: actions
priority: 0
- id: check-github-actions
alias: actions
- repo: https://github.com/rhysd/actionlint
rev: v1.7.12
hooks:
- id: actionlint
alias: actions
stages: [manual]
args:
- "-ignore=SC2129" # ignorable stylistic lint from shellcheck
- "-ignore=SC2016" # another shellcheck lint: seems to have false positives?
language: golang # means renovate will also update `additional_dependencies`
additional_dependencies:
# actionlint has a shellcheck integration which extracts shell scripts in `run:` steps from GitHub Actions
# and checks these with shellcheck. This is arguably its most useful feature,
# but the integration only works if shellcheck is installed
- "github.com/wasilibs/go-shellcheck/cmd/shellcheck@v0.11.1"
# see https://github.com/rhysd/actionlint/issues/46
exclude: ^\.github/actions
priority: 0
- repo: https://github.com/zizmorcore/zizmor-pre-commit
# Zizmor version.
rev: v1.24.1
hooks:
# Run the linter.
- id: zizmor
alias: actions
# * Notebook specific --------------------------------------------------------
# * Strip out metadata from notebooks
- repo: https://github.com/kynan/nbstripout
rev: 0.9.1
hooks:
- id: nbstripout
args:
- "--keep-output"
- "--keep-count"
- "--extra-keys"
- "metadata.kernelspec metadata.kernel_spec"
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.9.1
hooks:
# ** typos
- id: nbqa
name: nbqa-typos
alias: typos
additional_dependencies: &typos-deps
- typos==1.45.1
args:
- typos
- --force-exclude
- --no-check-filenames
- --write-changes
- --nbqa-shell
- id: nbqa
name: nbqa-typos-markdown
alias: typos
additional_dependencies: *typos-deps
args:
- typos
- --force-exclude
- --no-check-filenames
- --write-changes
- --nbqa-shell
- --nbqa-md
# ** symlink in notebooks from example/usage to docs/example/usage
- repo: local
hooks:
- id: symlink-docs-examples-notebooks
name: symlink-docs-examples-notebooks
entry: python tools/symlink_docs_examples_notebooks.py
language: python
files: ^docs/examples/.*\.md$
pass_filenames: false
# * Other tools --------------------------------------------------------------