@@ -2,190 +2,206 @@ minimum_pre_commit_version: 4.0.1
2
2
# run `pre-commit autoupdate --freeze` to update all hooks
3
3
default_install_hook_types : [pre-commit, post-checkout]
4
4
repos :
5
+ # Git-related
6
+ - repo : https://github.com/jumanjihouse/pre-commit-hooks
7
+ rev : 38980559e3a605691d6579f96222c30778e5a69e # frozen: 3.0.0
8
+ hooks :
9
+ - id : git-dirty
5
10
6
- # Git-related
7
- - repo : https://github.com/jumanjihouse/pre-commit-hooks
8
- rev : 38980559e3a605691d6579f96222c30778e5a69e # frozen: 3.0.0
9
- hooks :
10
- - id : git-dirty
11
-
12
- # package management
13
- - repo : local
14
- hooks :
15
- - id : uv-check
16
- name : check pyproject.toml for valid uv config
17
- entry : bash -c 'uv lock --check'
18
- language : system
19
- pass_filenames : false
20
- verbose : true
21
- files : ' ^pyproject.toml$|^uv.lock$'
22
-
23
- - id : sync-dependencies-on-commit
24
- name : ensure python dependencies are up to date during commits
25
- stages : [pre-commit]
26
- # When the install does change things, it exits 0, so needed to check for the phrase 'operations' in stdout in order to cause things pre-commit command to fail
27
- entry : python -c "import subprocess,sys; results=subprocess.run(['uv', 'sync', '--frozen'],timeout=360,capture_output=True); print ('stdout- ' + results.stdout.decode('utf-8', 'strict')); print ('stderr- ' + results.stderr.decode('utf-8', 'strict')); sys.exit(int(results.returncode or int('Installed' in results.stdout.decode('utf-8', 'strict'))));"
28
- # don't pass filenames else the command line sees them twice
29
- pass_filenames : false
30
- language : system
31
- files : ' uv.lock$'
32
- verbose : true
33
-
34
- - id : sync-dependencies-post-checkout
35
- name : ensure python dependencies are up to date during checkouts
36
- stages : [post-checkout]
37
- entry : bash -c 'uv sync --frozen'
38
- pass_filenames : false
39
- language : system
40
- always_run : true
41
- verbose : true
42
-
43
-
44
- # Reformatting (should generally come before any file format or other checks, because reformatting can change things)
45
- - repo : https://github.com/crate-ci/typos
46
- rev : 2300ad1b6b5c37da54bcafb1a06211196503eac9 # frozen: v1
11
+ # package management
12
+ - repo : local
13
+ hooks :
14
+ - id : uv-check
15
+ name : check pyproject.toml for valid uv config
16
+ entry : bash -c 'uv lock --check'
17
+ language : system
18
+ pass_filenames : false
19
+ verbose : true
20
+ files : " ^pyproject.toml$|^uv.lock$"
21
+
22
+ - id : sync-dependencies-on-commit
23
+ name : ensure python dependencies are up to date during commits
24
+ stages :
25
+ [pre-commit]
26
+ # When the install does change things, it exits 0, so needed to check for the phrase 'operations' in stdout in order to cause things pre-commit command to fail
27
+ entry : python -c "import subprocess,sys; results=subprocess.run(['uv', 'sync', '--frozen'],timeout=360,capture_output=True); print ('stdout- ' + results.stdout.decode('utf-8', 'strict')); print ('stderr- ' + results.stderr.decode('utf-8', 'strict')); sys.exit(int(results.returncode or int('Installed' in results.stdout.decode('utf-8', 'strict'))));"
28
+ # don't pass filenames else the command line sees them twice
29
+ pass_filenames : false
30
+ language : system
31
+ files : " uv.lock$"
32
+ verbose : true
33
+
34
+ - id : sync-dependencies-post-checkout
35
+ name : ensure python dependencies are up to date during checkouts
36
+ stages : [post-checkout]
37
+ entry : bash -c 'uv sync --frozen'
38
+ pass_filenames : false
39
+ language : system
40
+ always_run : true
41
+ verbose : true
42
+
43
+ # Reformatting (should generally come before any file format or other checks, because reformatting can change things)
44
+ - repo : https://github.com/crate-ci/typos
45
+ rev : 2300ad1b6b5c37da54bcafb1a06211196503eac9 # frozen: v1
47
46
hooks :
48
47
- id : typos
49
- - repo : https://github.com/pre-commit/pre-commit-hooks
50
- rev : cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
48
+ - repo : https://github.com/pre-commit/pre-commit-hooks
49
+ rev : cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
51
50
hooks :
52
51
- id : trailing-whitespace
53
52
- id : end-of-file-fixer
54
53
# the XML formatter hook doesn't leave a blank line at the end, so excluding XML files from this hook to avoid conflicts
55
- exclude : | # the extra trailing newline in the pull request template makes it easier to click there in the github console. The CLI that programmatically generates devcontainer-lock.json always ends the file incompatible with this hook.
56
- (?x)^(
57
- .github/pull_request_template.md|
58
- template/.github/pull_request_template.md|
59
- template/.copier-answers.yml.jinja-base|
60
- template/template/.copier-answers.yml.jinja|
61
- template/.copier-answers.yml.jinja|
62
- .devcontainer/devcontainer-lock.json|
63
- .copier-answers.yml|
64
- .*\.xml|
65
- )$
54
+ exclude :
55
+ | # the extra trailing newline in the pull request template makes it easier to click there in the github console. The CLI that programmatically generates devcontainer-lock.json always ends the file incompatible with this hook.
56
+ (?x)^(
57
+ .github/pull_request_template.md|
58
+ template/.github/pull_request_template.md|
59
+ template/.copier-answers.yml.jinja-base|
60
+ template/template/.copier-answers.yml.jinja|
61
+ template/.copier-answers.yml.jinja|
62
+ .devcontainer/devcontainer-lock.json|
63
+ .copier-answers.yml|
64
+ .*\.xml|
65
+ )$
66
66
- id : pretty-format-json
67
67
exclude : |
68
- (?x)^(
69
- .devcontainer/devcontainer.json|
70
- .devcontainer/devcontainer-lock.json|
71
- .*devcontainer.json|
72
- .*pyrightconfig.json|
73
- .*tsconfig.json|
74
- )$
68
+ (?x)^(
69
+ .devcontainer/devcontainer.json|
70
+ .devcontainer/devcontainer-lock.json|
71
+ .*devcontainer.json|
72
+ .*pyrightconfig.json|
73
+ .*tsconfig.json|
74
+ )$
75
75
args : [--autofix, --no-sort-keys]
76
76
77
- - repo : https://github.com/myint/docformatter
77
+ - repo : https://github.com/pre-commit/mirrors-prettier # TODO: switch to a different approach...this was archived in 2024
78
+ rev : f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8
79
+ hooks :
80
+ - id : prettier
81
+ # TODO: get template YAML and MD files more in line with prettier expectations so we can start using prettier on those too
82
+ exclude : |
83
+ (?x)^(
84
+ .devcontainer/devcontainer.json|
85
+ .devcontainer/devcontainer-lock.json|
86
+ .*devcontainer.json|
87
+ .*pyrightconfig.json|
88
+ .*tsconfig.json|
89
+ .*.yaml|
90
+ .*.yml|
91
+ .*.md|
92
+ )$
93
+
94
+ - repo : https://github.com/myint/docformatter
78
95
# black seems to be working on formatting docstrings, but use this for now
79
- rev : eb1df347edd128b30cd3368dddc3aa65edcfac38 # tip of main that is compatible with pre-commit v4
96
+ rev : eb1df347edd128b30cd3368dddc3aa65edcfac38 # tip of main that is compatible with pre-commit v4
80
97
hooks :
81
98
- id : docformatter
82
99
exclude : (tests*)|(exceptions\.py)|(warnings\.py)
83
100
args :
84
- - --in-place
85
- - --wrap-summaries=150
86
- - --wrap-descriptions=150
101
+ - --in-place
102
+ - --wrap-summaries=150
103
+ - --wrap-descriptions=150
87
104
88
- - repo : https://github.com/pamoller/xmlformatter
89
- rev : 47ae0fb9cf2a515f8a2666050fac66fd719ae530 # frozen: v0.2.8
105
+ - repo : https://github.com/pamoller/xmlformatter
106
+ rev : 47ae0fb9cf2a515f8a2666050fac66fd719ae530 # frozen: v0.2.8
90
107
hooks :
91
108
- id : xml-formatter
92
109
exclude : |
93
- (?x)^(
94
- .*/__snapshots__/.*|
95
- )$
96
-
110
+ (?x)^(
111
+ .*/__snapshots__/.*|
112
+ )$
97
113
98
- # Invalid File Checks
99
- - repo : https://github.com/pre-commit/pre-commit-hooks
100
- rev : cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
114
+ # Invalid File Checks
115
+ - repo : https://github.com/pre-commit/pre-commit-hooks
116
+ rev : cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
101
117
hooks :
102
- - id : check-added-large-files
103
- args : [' --maxkb=123' ]
118
+ - id : check-added-large-files
119
+ args : [" --maxkb=123" ]
104
120
exclude : (uv.lock)|(pnpm-lock.yaml)
105
- - id : check-json
121
+ - id : check-json
106
122
# exclude JSON5 or JSONC files with comments
107
- exclude : |
108
- (?x)^(
109
- .devcontainer/devcontainer.json|
110
- .devcontainer/devcontainer-lock.json|
111
- .*devcontainer.json|
112
- .*pyrightconfig.json|
113
- .*tsconfig.json|
114
- )$
115
- - id : check-yaml
123
+ exclude : |
124
+ (?x)^(
125
+ .devcontainer/devcontainer.json|
126
+ .devcontainer/devcontainer-lock.json|
127
+ .*devcontainer.json|
128
+ .*pyrightconfig.json|
129
+ .*tsconfig.json|
130
+ )$
131
+ - id : check-yaml
116
132
exclude : .copier-answers.yml # This is an autogenerated YAML file by Copier that throws 'found unhashable key' errors
117
- - id : check-xml
118
- - id : check-merge-conflict
119
- - id : check-case-conflict
133
+ - id : check-xml
134
+ - id : check-merge-conflict
135
+ - id : check-case-conflict
120
136
121
- - repo : https://github.com/maresb/check-json5
137
+ - repo : https://github.com/maresb/check-json5
122
138
rev : 893a2b5a0a27c3540bd8fcafe2968ccc05237179 # 1.0
123
139
hooks :
124
- - id : check-json5
140
+ - id : check-json5
125
141
files : |
126
- (?x)^(
127
- .devcontainer/devcontainer.json|
128
- .devcontainer/devcontainer-lock.json|
129
- .*devcontainer.json|
130
- .*pyrightconfig.json|
131
- .*tsconfig.json|
132
- )$
133
-
134
- - repo : local
142
+ (?x)^(
143
+ .devcontainer/devcontainer.json|
144
+ .devcontainer/devcontainer-lock.json|
145
+ .*devcontainer.json|
146
+ .*pyrightconfig.json|
147
+ .*tsconfig.json|
148
+ )$
149
+
150
+ - repo : local
135
151
hooks :
136
- - id : forbidden-files
152
+ - id : forbidden-files
137
153
name : forbidden files
138
154
entry : found copier update rejection files; review them and remove them
139
155
language : fail
140
156
files : " \\ .rej$"
141
157
142
- # Safety/Security Issues
143
- - repo : https://github.com/pre-commit/pre-commit-hooks
144
- rev : cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
158
+ # Safety/Security Issues
159
+ - repo : https://github.com/pre-commit/pre-commit-hooks
160
+ rev : cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
145
161
hooks :
146
- - id : detect-private-key
162
+ - id : detect-private-key
147
163
148
- # Linting
164
+ # Linting
149
165
150
- - repo : https://github.com/Lucas-C/pre-commit-hooks-markup
166
+ - repo : https://github.com/Lucas-C/pre-commit-hooks-markup
151
167
rev : 501f3d60cee13c712492103343bc23efdc7b3d1f # v1.0.1
152
168
hooks :
153
- - id : rst-linter
169
+ - id : rst-linter
154
170
# this hook fails on Sphinx documentation https://github.com/Lucas-C/pre-commit-hooks-markup/issues/13
155
171
exclude : docs/.*\.rst$
156
172
157
- - repo : https://github.com/hadolint/hadolint
158
- rev : c3dc18df7a501f02a560a2cc7ba3c69a85ca01d3 # frozen: v2.13.1-beta
173
+ - repo : https://github.com/hadolint/hadolint
174
+ rev : c3dc18df7a501f02a560a2cc7ba3c69a85ca01d3 # frozen: v2.13.1-beta
159
175
hooks :
160
- - id : hadolint-docker
176
+ - id : hadolint-docker
161
177
name : Lint Dockerfiles
162
178
description : Runs hadolint to lint Dockerfiles
163
179
164
- - repo : https://github.com/astral-sh/ruff-pre-commit
165
- rev : 41d2daf392fbf43341a77f24a9c6481a4b66af98 # frozen: v0.9.10
180
+ - repo : https://github.com/astral-sh/ruff-pre-commit
181
+ rev : 99abe27a5a16f301d9e0a3828181399dfbf54ebd # frozen: v0.11.0
166
182
hooks :
167
- - id : ruff
183
+ - id : ruff
168
184
name : ruff-src
169
- args : [ --fix, --config=./ruff.toml ]
185
+ args : [--fix, --config=./ruff.toml]
170
186
files : src/.+\.py$
171
- - id : ruff
187
+ - id : ruff
172
188
name : ruff-tests
173
- args : [ --fix, --config=./ruff-test.toml ]
189
+ args : [--fix, --config=./ruff-test.toml]
174
190
files : tests?/.+\.py$
175
- - id : ruff-format
191
+ - id : ruff-format
176
192
177
- - repo : https://github.com/pylint-dev/pylint
178
- rev : aaab3ccb541532d2bcdf0410ab93ff4fafc266f5 # frozen: v3.3.5
193
+ - repo : https://github.com/pylint-dev/pylint
194
+ rev : aaab3ccb541532d2bcdf0410ab93ff4fafc266f5 # frozen: v3.3.5
179
195
hooks :
180
- - id : pylint
196
+ - id : pylint
181
197
name : pylint
182
198
args :
183
- - --rcfile=./pylintrc.toml
199
+ - --rcfile=./pylintrc.toml
184
200
verbose : true
185
201
186
- - repo : local
202
+ - repo : local
187
203
hooks :
188
- - id : pyright
204
+ - id : pyright
189
205
name : pyright
190
206
entry : bash -c "uv run pyright"
191
207
files : ' .+\.py$'
0 commit comments