-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.pre-commit-config.yaml
177 lines (166 loc) · 4.87 KB
/
.pre-commit-config.yaml
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
# 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
default_install_hook_types:
- pre-commit
- commit-msg
repos:
# * Top level
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
exclude: ^uv[.]lock
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: check-json
- id: check-toml
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
# * Sync dependencies
- repo: https://github.com/mxr/sync-pre-commit-deps
rev: v0.0.3
hooks:
- id: sync-pre-commit-deps
# * Pyproject-fmt
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.5.0
hooks:
- id: pyproject-fmt
args: [--indent=4, --keep-full-version]
files: ""
types: [toml]
# * Prettier
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.4.2
hooks:
- id: prettier
alias: markdownlint
stages: [pre-commit]
# * Markdown
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.17.2
hooks:
- id: markdownlint-cli2
alias: markdownlint
args: [--style, prettier]
# language_version: 10.9.0
# * Linting
# To be replace by ruff analog when I find one ...
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.19.1
hooks:
- id: blacken-docs
additional_dependencies:
- black==24.10.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.2
hooks:
- id: ruff
alias: ruff-all
types_or: &ruff-types-or [python, pyi, jupyter]
args: [--fix, --show-fixes]
- id: ruff-format
alias: ruff-all
types_or: *ruff-types-or
# * Spelling
- repo: https://github.com/codespell-project/codespell
rev: v2.4.0
hooks:
- id: codespell
additional_dependencies: [tomli]
args: [-I, docs/spelling_wordlist.txt]
exclude_types: [jupyter]
exclude: ^uv[.]lock$|^requirements
# * Notebook spelling
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.9.1
hooks:
- id: nbqa
alias: nbqa-codespell
name: nbqa-codespell
additional_dependencies: &codespell-deps [codespell==2.4.0, tomli] # make sure same as above
args:
[codespell, --ignore-words=docs/spelling_wordlist.txt, --nbqa-shell]
- id: nbqa
alias: nbqa-codespell
name: nbqa-codespell-markdown
additional_dependencies: *codespell-deps
args:
[
codespell,
--ignore-words=docs/spelling_wordlist.txt,
--nbqa-shell,
--nbqa-md,
]
# * Strip out metadata from notebooks
- repo: https://github.com/kynan/nbstripout
rev: 0.8.1
hooks:
- id: nbstripout
args: [
--keep-output, # keep output (needed for nbval testing)
--keep-count, # Errors with nbval without this...
--extra-keys, # strip out kernelspec. If use this, always have to reselect kernel when open a notebook...
"metadata.kernelspec metadata.kernel_spec",
]
# * Commit message
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.1.0
hooks:
- id: commitizen
stages: [commit-msg]
# * uv
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.5.23
hooks:
- id: uv-lock
args: [--locked]
# * Manual Linting ------------------------------------------------------------
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.1
hooks:
- id: pyupgrade
stages: [manual]
args: [--py38-plus]
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.9.1
hooks:
- id: nbqa-pyupgrade
additional_dependencies: [pyupgrade]
stages: [manual]
args: [--py38-plus]
- repo: https://github.com/mrtazz/checkmake.git
# Or another commit hash or version
rev: 0.2.2
hooks:
- id: checkmake
stages: [manual]
# ** typos
# Probably stick with codespell, but this might also be nice...
- repo: https://github.com/crate-ci/typos
rev: dictgen-v0.3.1
hooks:
- id: typos
stages: [manual]
exclude: "[.]ipynb$|^uv[.]lock$|^requirements"
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.9.1
hooks:
- id: nbqa
alias: nbqa-typos
name: nbqa-typos
additional_dependencies: &typos-deps [typos==1.29.4] # make sure save version as above.
stages: [manual]
args: [typos, --nbqa-shell]
- id: nbqa
alias: nbqa-typos
name: nbqa-typos-markdown
additional_dependencies: *typos-deps
stages: [manual]
args: [typos, --nbqa-shell, --nbqa-md]