-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
.pre-commit-config.yaml
337 lines (316 loc) · 8.71 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
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
---
ci:
autoupdate_schedule: quarterly
skip:
- nitpick-check # can't run on pre-commit.ci while using gh://
repos:
- repo: local
hooks:
- id: immutable-setup-py
name: Verify that setup.py stays immutable
description: >-
This is a sanity check that makes sure that
the `setup.py` file isn't changed.
# Using Python here because using
# shell test does not seem to work in CIs:
entry: >-
sh -c 'git hash-object setup.py
|
python -c raise\
SystemExit\(input\(\)\ !=\ \"38cc2638672e1f6ca56e4d5ceaf16451dd702b67\"\)
'
pass_filenames: false
language: system
files: >-
^setup\.py$
- id: immutable-tests-init-py
name: Verify that tests/__init__.py stays immutable
description: >-
This is a sanity check that makes sure that
the `tests/__init__.py` file isn't changed.
# Using Python here because using
# shell test does not seem to work in CIs:
entry: >-
sh -c 'git hash-object tests/__init__.py
|
python -c raise\
SystemExit\(input\(\)\ !=\ \"674d7b907efe86dafcd2b8ddc5655fc55ddf5395\"\)
'
pass_filenames: false
language: system
files: >-
^tests/__init__\.py$
- id: enforced-versions
name: Verify that enforced hook versions stay unchanged
description: >-
This is a sanity check and fixer that makes sure that
the some hook versions in this file remain matching the
corresponding request in the `# enforce-version` comment.
# Using Python here because using
# shell test does not always work in CIs:
entry: >-
python -c 'import pathlib, re, sys;
pre_commit_config = pathlib.Path(sys.argv[1]);
cfg_txt = pre_commit_config.read_text();
new_cfg_txt = re.sub(
r"(?P<spaces>\s+)rev:\s+(?:v?\d+\.\d+\.\d+)\s+"
r"#\s+enforce-version:\s(?P<enforced_version>v?\d+\.\d+\.\d+)"
r"[ \t\f\v]*",
r"\g<spaces>rev: \g<enforced_version> "
r"# enforce-version: \g<enforced_version>",
cfg_txt,
);
cfg_txt != new_cfg_txt and
pre_commit_config.write_text(new_cfg_txt) and
sys.exit(1)
'
pass_filenames: true
language: system
files: >-
^\.pre-commit-config\.ya?ml$
types:
- yaml
- repo: https://github.com/asottile/add-trailing-comma.git
rev: v3.1.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/asottile/pyupgrade.git
rev: v3.16.0
hooks:
- id: pyupgrade
args:
- --py36-plus
- repo: https://github.com/PyCQA/isort.git
rev: 5.13.2
hooks:
- id: isort
args:
- --honor-noqa
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
rev: v1.5.5
hooks:
- id: remove-tabs
- repo: https://github.com/python-jsonschema/check-jsonschema.git
rev: 0.28.6
hooks:
- id: check-github-workflows
files: ^\.github/workflows/[^/]+$
types:
- yaml
- id: check-jsonschema
name: Check GitHub Workflows set timeout-minutes
args:
- --builtin-schema
- github-workflows-require-timeout
files: ^\.github/workflows/[^/]+$
types:
- yaml
# yamllint disable rule:comments-indentation
# - id: check-readthedocs
# yamllint enable rule:comments-indentation
- repo: https://github.com/andreoliwa/nitpick.git
rev: v0.35.0
hooks:
- id: nitpick-check
args:
- -v
pass_filenames: false
stages: []
- repo: https://github.com/pre-commit/pygrep-hooks.git
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-mock-methods
- id: python-no-eval
- id: python-no-log-warn
- id: rst-backticks
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v4.6.0
hooks:
# Side-effects:
- id: trailing-whitespace
- id: check-merge-conflict
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: requirements-txt-fixer
exclude: >-
^(docs/requirements|requirements-build)\.txt$
# Non-modifying checks:
- id: name-tests-test
files: >-
^tests/[^_].*\.py$
- id: check-added-large-files
- id: check-byte-order-marker
- id: check-case-conflict
# disabled due to pre-commit/pre-commit-hooks#159
# - id: check-docstring-first
- id: check-json
- id: check-symlinks
- id: check-yaml
# args:
# - --unsafe
- id: detect-private-key
# Heavy checks:
- id: check-ast
- id: debug-statements
- repo: https://github.com/Lucas-C/pre-commit-hooks-markup.git
rev: v1.0.1
hooks:
- id: rst-linter
files: >-
^README\.rst$
- repo: https://github.com/PyCQA/pydocstyle.git
rev: 6.3.0
hooks:
- id: pydocstyle
- repo: https://github.com/codespell-project/codespell.git
rev: v2.3.0
hooks:
- id: codespell
exclude: >-
^\.github/\.json-schemas/.*\.json$
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
- id: yamllint
files: \.(yaml|yml)$
types: [file, yaml]
args:
- --strict
- repo: https://github.com/openstack/bashate.git
rev: 2.1.1
hooks:
- id: bashate
args:
- -i
- E006
- repo: https://github.com/shellcheck-py/shellcheck-py.git
rev: v0.10.0.1
hooks:
- id: shellcheck
- repo: https://github.com/PyCQA/flake8.git
rev: 7.1.0
hooks:
- id: flake8
additional_dependencies:
- flake8-2020 ~= 1.7.0
- flake8-length ~= 0.3.0
- flake8-pytest-style ~= 1.6.0
- wemake-python-styleguide ~= 0.19.2
language_version: python3
- repo: local
hooks:
- id: pylint
language: system
name: PyLint
files: \.py$
entry: python -m pylint
args:
- --rcfile
- .pylintrc
stages:
- manual
- repo: https://github.com/pre-commit/mirrors-mypy.git
rev: v1.11.2
hooks:
- id: mypy
alias: mypy-py313
name: MyPy, for Python 3.13
additional_dependencies:
- lxml # dep of `--txt-report`, `--cobertura-xml-report` & `--html-report`
- pytest
- Sphinx >= 3.1.2
- types-colorama
- types-Pillow
- types-Pygments
- types-pytz
- types-setuptools
args:
- --python-version=3.13
- --txt-report=.tox/.tmp/.test-results/mypy--py-3.13
- --cobertura-xml-report=.tox/.tmp/.test-results/mypy--py-3.13
- --html-report=.tox/.tmp/.test-results/mypy--py-3.13
pass_filenames: false
- id: mypy
alias: mypy-py311
name: MyPy, for Python 3.11
additional_dependencies:
- lxml # dep of `--txt-report`, `--cobertura-xml-report` & `--html-report`
- pytest
- Sphinx >= 3.1.2
- types-colorama
- types-Pillow
- types-Pygments
- types-pytz
- types-setuptools
args:
- --python-version=3.11
- --txt-report=.tox/.tmp/.test-results/mypy--py-3.11
- --cobertura-xml-report=.tox/.tmp/.test-results/mypy--py-3.11
- --html-report=.tox/.tmp/.test-results/mypy--py-3.11
pass_filenames: false
- id: mypy
alias: mypy-py39
name: MyPy, for Python 3.9
additional_dependencies:
- lxml # dep of `--txt-report`, `--cobertura-xml-report` & `--html-report`
- pytest
- Sphinx >= 3.1.2
- types-colorama
- types-Pillow
- types-Pygments
- types-pytz
- types-setuptools
args:
- --python-version=3.9
- --txt-report=.tox/.tmp/.test-results/mypy--py-3.9
- --cobertura-xml-report=.tox/.tmp/.test-results/mypy--py-3.9
- --html-report=.tox/.tmp/.test-results/mypy--py-3.9
pass_filenames: false
- repo: https://github.com/pre-commit/mirrors-mypy.git
# NOTE: This is kept at v1.5.1 until we stop supporting Python 3.6.
rev: v1.5.1 # enforce-version: v1.5.1
hooks:
- id: mypy
alias: mypy-py37
name: MyPy, for Python 3.7
additional_dependencies:
- importlib_metadata
- lxml # dep of `--txt-report`, `--cobertura-xml-report` & `--html-report`
- pytest ~= 7.4.4 # last to have Python 3.6-compatible syntax
- Sphinx >= 3.1.2, < 6
- types-colorama
- types-Pillow
- types-Pygments
- types-pytz
- types-setuptools
- types-typed-ast
- typing-extensions # Literal
args:
- --python-version=3.7
- --txt-report=.tox/.tmp/.test-results/mypy--py-3.7
- --cobertura-xml-report=.tox/.tmp/.test-results/mypy--py-3.7
- --html-report=.tox/.tmp/.test-results/mypy--py-3.7
pass_filenames: false
- id: mypy
alias: mypy-py36
name: MyPy, for Python 3.6
additional_dependencies:
- importlib_metadata
- lxml # dep of `--txt-report`, `--cobertura-xml-report` & `--html-report`
- pytest ~= 7.4.4 # last to have Python 3.6-compatible syntax
- Sphinx >= 3.1.2, < 6
- types-colorama
- types-Pillow
- types-Pygments
- types-pytz
- types-setuptools
- types-typed-ast
- typing-extensions # Literal
args:
- --python-version=3.6
- --txt-report=.tox/.tmp/.test-results/mypy--py-3.6
- --cobertura-xml-report=.tox/.tmp/.test-results/mypy--py-3.6
- --html-report=.tox/.tmp/.test-results/mypy--py-3.6
pass_filenames: false
...