-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
.pre-commit-config.yaml
342 lines (295 loc) · 11.2 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
338
339
340
341
342
# Apply to all files without committing:
# pre-commit run --all-files
# Update this file:
# pre-commit autoupdate
default_language_version:
# force all unspecified python hooks to run python3
python: python3
node: 22.4.1
# https://pre-commit.ci/
ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
autofix_prs: false
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: monthly
skip:
- eslint # Fails due to missing node environment in CI
submodules: false
# pre-commit setup
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# Identify invalid files
- id: check-ast
name: check-ast (Python)
description: Check for syntax errors in Python files.
- id: check-yaml
name: check-yaml (YAML)
description: Check for syntax errors in YAML files.
- id: check-json
name: check-json (JSON)
description: Check for syntax errors in JSON files.
- id: check-toml
name: check-toml (TOML)
description: Check for syntax errors in TOML files.
- id: check-xml
name: check-xml (XML)
description: Check for syntax errors in XML files.
# git checks
- id: check-merge-conflict
name: Check for merge conflict strings
description: Check for files that contain merge conflict strings.
- id: check-added-large-files
name: Check for large files
description: Check for large files that were added to the repository.
args:
- --maxkb=1000
- id: detect-private-key
name: Detect private key
description: Check for private keys in the repository.
- id: check-case-conflict
name: Check for case conflicts
description: Check for files with names that differ only in case.
# Python checks
- id: check-docstring-first
name: Check for docstring in first line
description: Check that the first line of a file is a docstring.
- id: debug-statements
name: Check for debug statements
description: Check for print statements and pdb imports.
- id: requirements-txt-fixer
name: Fix requirements.txt
description: Fix the formatting of requirements.txt files.
- id: fix-encoding-pragma
name: Fix encoding pragma
description: Fix the encoding pragma in Python files.
args:
- --remove
- id: fix-byte-order-marker
name: Fix byte order marker
description: Fix the byte order marker in Python files.
- id: check-builtin-literals
name: Check for built-in literals
description: Check for built-in literals in Python code.
# General quality checks
- id: mixed-line-ending
name: Mixed line ending
description: Check for mixed line endings.
args:
- --fix=lf
- id: trailing-whitespace
name: Trailing whitespace
description: Check for trailing whitespace.
args:
- --markdown-linebreak-ext=md
exclude: |
(?x)(
.min(.css|.css.map|.js|.js.map)|
locale/|
static/(.*)/libs/
)
- id: check-executables-have-shebangs
name: Check for shebangs in executables
description: Check that executables have shebangs.
- id: end-of-file-fixer
name: End of file fixer
description: Ensure that files end with a newline.
exclude: |
(?x)(
.min(.css|.css.map|.js|.js.map)|
locale/|
static/(.*)/libs/
)
- repo: https://github.com/eslint/eslint
rev: v9.14.0
hooks:
- id: eslint
name: ESLint
description: Check for problems in JavaScript files.
language: node
exclude: |
(?x)(
.min(.js|.js.map)|
static/(.*)/libs/
)
# additional_dependencies:
# # eslint itself needs to be here when using additional_dependencies.
# - eslint@9.14.0 # https://github.com/eslint/eslint/releases/latest
# - globals@15.12.0 # https://github.com/sindresorhus/globals/releases/latest
- repo: https://github.com/thibaudcolas/pre-commit-stylelint
rev: v16.10.0
hooks:
- id: stylelint
name: Stylelint
description: Check for problems in CSS files.
language: node
exclude: |
(?x)(
.min(.css|.css.map)|
static/(.*)/libs/
)
args:
- --formatter=compact
additional_dependencies:
# stylelint itself needs to be here when using additional_dependencies.
- stylelint@16.10.0 # https://github.com/stylelint/stylelint/releases/latest
- stylelint-config-standard@36.0.1 # https://github.com/stylelint/stylelint-config-standard/releases/latest
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa # Enforce that noqa annotations always occur with specific codes. Sample annotations: # noqa: F401, # noqa: F401,W203
name: Check for blanket noqa
description: Check for blanket noqa annotations.
- id: python-check-blanket-type-ignore # Enforce that # type: ignore annotations always occur with specific codes. Sample annotations: # type: ignore[attr-defined], # type: ignore[attr-defined, name-defined]
name: Check for blanket type ignore
description: Check for blanket type ignore annotations.
- id: python-check-mock-methods # Prevent common mistakes of assert mck.not_called(), assert mck.called_once_with(...) and mck.assert_called
name: Check for mock methods
description: Check for common mistakes of mock methods.
- id: python-no-eval # A quick check for the eval() built-in function
name: Check for eval
description: Check for the eval() built-in function.
- id: python-no-log-warn # A quick check for the deprecated .warn() method of python loggers
name: Check for log warn
description: Check for the deprecated .warn() method of python loggers.
- id: python-use-type-annotations # Enforce that python3.6+ type annotations are used instead of type comments
name: Use type annotations
description: Enforce that python3.6+ type annotations are used instead of type comments.
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 3.0.3
hooks:
- id: editorconfig-checker
name: EditorConfig Checker
description: Check for compliance with the definitions in the EditorConfig file.
exclude: |
(?x)(
LICENSE|
.min(.css|.css.map|.js|.js.map)|
static/(.*)/libs/
)
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.22.1
hooks:
- id: django-upgrade
name: Django upgrade
description: Upgrade Django code to a target version.
args:
- --target-version=4.2 # Minimum supported Django version for AA. Update as needed.
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
hooks:
- id: pyupgrade
name: PyUpgrade
description: Upgrade syntax to newer versions of Python.
args:
- --py310-plus # Minimum required Python version for AA. Update as needed.
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8
name: Flake8
description: Check for style and complexity issues in Python code.
- repo: https://github.com/asottile/yesqa
rev: v1.5.0
hooks:
- id: yesqa
name: YesQA
description: Check for extraneous `# noqa` comments.
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
name: Isort
description: Sort imports.
- repo: https://github.com/Pierre-Sassoulas/black-disable-checker/
rev: v1.1.3
hooks:
- id: black-disable-checker
name: Black disable checker
description: Check for black disable comments.
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
name: Black
description: Format Python code.
args:
- --target-version=py310 # Minimum required Python version for AA. Update as needed.
- repo: https://github.com/asottile/blacken-docs
rev: 1.19.1
hooks:
- id: blacken-docs
name: Blacken docs
description: Format Python code in documentation files.
additional_dependencies:
- black==24.10.0 # https://github.com/psf/black/releases/latest
args:
- --target-version=py310 # Minimum required Python version for AA. Update as needed.
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.18
hooks:
- id: mdformat
name: Mdformat
description: Format Markdown files.
exclude: |
(?x)(
.github/|
static/(.*)/libs/
)
additional_dependencies:
- mdformat-gfm==0.3.7 # Mdformat plugin for GitHub Flavored Markdown compatibility » https://github.com/hukkin/mdformat-gfm/tags
- mdformat-toc==0.3.0 # Mdformat plugin to generate a table of contents » https://github.com/hukkin/mdformat-toc/tags
- mdformat-black==0.1.1 # Mdformat plugin to Blacken Python code blocks » https://github.com/hukkin/mdformat-black/tags
- mdformat-shfmt==0.2.0 # Mdformat plugin to format shell code blocks » https://github.com/hukkin/mdformat-shfmt/tags
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 1.4.1
hooks:
- id: tox-ini-fmt
name: tox.ini formatter
description: Format the tox.ini file.
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.5.0
hooks:
- id: pyproject-fmt
name: pyproject.toml formatter
description: Format the pyproject.toml file.
args:
- --indent=4
additional_dependencies:
- tox==4.23.2 # https://github.com/tox-dev/tox/releases/latest
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.22
hooks:
- id: validate-pyproject
name: Validate pyproject.toml
description: Validate the pyproject.toml file.
- repo: https://github.com/pylint-dev/pylint
rev: v3.3.1
hooks:
- id: pylint
name: Pylint
description: Check for errors and code smells in Python code.
args:
- --py-version=3.10 # Minimum required Python version for AA. Update as needed.
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.4
hooks:
- id: check-github-actions
name: Check GitHub Actions
description: This hook checks that GitHub Actions files are valid.
args:
- --verbose
- id: check-github-workflows
name: Check GitHub Workflows
description: This hook checks that GitHub Workflows files are valid.
args:
- --verbose
- id: check-dependabot
name: Check Dependabot Configuration
description: This hook checks that Dependabot configuration files are valid.
args:
- --verbose