-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
328 lines (318 loc) · 9.83 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
328 lines (318 loc) · 9.83 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
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
ci:
autofix_commit_msg: 'refactor(lint): apply automatic lint fixes'
autoupdate_commit_msg: 'chore(deps): bump pre-commit linter versions'
skip: [terraform_fmt, terraform_validate]
default_install_hook_types:
- commit-msg
- pre-commit
default_language_version:
python: python3.11
exclude: '^docker-tuning-primer/root/.*.sh$'
repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v4.4.0
hooks:
- id: conventional-pre-commit
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: check-yaml
args: [--allow-multiple-documents]
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=lf]
- id: trailing-whitespace
# python
- id: check-ast
- id: check-builtin-literals
- id: check-docstring-first
- id: debug-statements
- id: double-quote-string-fixer
- id: name-tests-test
- id: requirements-txt-fixer
- repo: https://github.com/PyCQA/pylint
rev: v4.0.7
hooks:
# TODO: pylint-import-modules support for pylint v3 (or alternative linter)
# - id: pylint
# name: pylint-docker-atc1441-exporter
# args:
# - --load-plugins=pylint.extensions.mccabe
# - --max-complexity=10
# - --max-line-length=79
# - --max-module-lines=500
# - --max-positional-arguments=10
# - --max-args=10
# - --score=n
# # TODO: narrow these down
# - -d broad-except
# - -d duplicate-code
# - -d fixme
# - -d import-error
# - -d invalid-name
# - -d locally-disabled
# - -d missing-docstring
# - -d too-few-public-methods
# - -d try-except-raise
# - -d ungrouped-imports # conflicts with reorder-python-imports
# - -d wrong-import-order # conflicts with reorder-python-imports
# files: docker-atc1441-exporter/
# language_version: python3.9
- &pylint
id: pylint
name: pylint-docker-gcloud-pubsub-emulator
args:
- --load-plugins=pylint.extensions.mccabe
- --max-complexity=10
- --max-line-length=79
- --max-module-lines=500
- --max-positional-arguments=10
- --max-args=10
- --score=n
# TODO: narrow these down
- -d broad-except
- -d duplicate-code
- -d fixme
- -d import-error
- -d invalid-name
- -d locally-disabled
- -d missing-docstring
- -d too-few-public-methods
- -d try-except-raise
- -d ungrouped-imports # conflicts with reorder-python-imports
- -d wrong-import-order # conflicts with reorder-python-imports
files: docker-gcloud-pubsub-emulator/
- <<: *pylint
name: pylint-task
files: task/
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.6
hooks:
- id: remove-crlf
- id: remove-tabs
exclude: 'Makefile'
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.17.0
hooks:
- id: reorder-python-imports
args: [--py39-plus]
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.2
hooks:
- id: pyupgrade
args: [--py39-plus]
- repo: https://github.com/asottile/add-trailing-comma
rev: v4.0.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v2.3.1
hooks:
# - id: mypy
# name: mypy-docker-atc1441-exporter
# require_serial: True
# language: python
# language_version: python3.9
# additional_dependencies:
# - prometheus-client==0.22.0
# args:
# - --show-error-codes
# - --strict
# - --strict-equality
# - --warn-unreachable
# files: docker-atc1441-exporter/
- &mypy
id: mypy
name: mypy-docker-gcloud-pubsub-emulator
require_serial: True
language: python
additional_dependencies:
- aiohttp==3.14.3
- google-cloud-pubsub==2.39.1
args:
- --show-error-codes
- --strict
- --strict-equality
- --warn-unreachable
files: docker-gcloud-pubsub-emulator/
- <<: *mypy
name: mypy-task
additional_dependencies:
- pydantic==2.11.4
- typer==0.16.0
files: task/
- repo: https://github.com/asottile/yesqa
rev: v1.5.0
hooks:
- id: yesqa
language: python
# N.B. keep these in sync with flake8, otherwise yesqa will remove
# required noqa's related to these plugins
additional_dependencies: &flake8deps
- flake8-2020==1.8.1
- flake8-broken-line==1.0.0
- flake8-builtins==3.1.0
- flake8-comprehensions==3.17.0
- flake8-import-restrictions==2.1
- repo: https://github.com/guilatrova/tryceratops
rev: v2.4.1
hooks:
- id: tryceratops
args:
- --autofix
- -iTRY003
- -iTRY100
- -iTRY101
- -iTRY301
- repo: https://github.com/hhatto/autopep8
rev: v2.3.2
hooks:
- id: autopep8
args: [-a, -i, -p2]
- repo: https://github.com/PyCQA/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
args:
- --ignore=D1,D203,D205,D212,D400,D401,D404,D407,D412,D413
- repo: https://github.com/PyCQA/flake8
rev: 7.3.0
hooks:
- id: flake8
language: python
additional_dependencies: *flake8deps
args:
# https://www.flake8rules.com/
# E501: Line too long. Covered by autopep8.
# E741: Do not use variables named 'I', 'O', or 'l'.
# W503: Line break occurred before a binary operator. Breaks PEP8.
# IMR200: Imports should only happen on module level, not locally. Covered by pylint.
# IMR241: When using 'from', import submodules not elements.
- --ignore=E501,E741,W503,IMR200,IMR241
- repo: https://github.com/dosisod/refurb
rev: v2.3.1
hooks:
# - id: refurb
# name: refurb-docker-atc1441-exporter
# args:
# - --python-version
# - '3.9'
# files: docker-atc1441-exporter/
- &refurb
id: refurb
name: refurb-docker-gcloud-pubsub-emulator
args:
- --python-version
- '3.11'
files: docker-gcloud-pubsub-emulator/
- <<: *refurb
name: refurb-task
args:
- --python-version
- '3.11'
files: task/
- repo: local
hooks:
- id: poetry-check
name: check pyproject.toml validity
description: 'Validate the structure of the pyproject.toml file'
entry: bash -c 'set -e; for toml in "$@"; do pushd ./${toml%pyproject.toml}; poetry check; popd; done' --
language: python
additional_dependencies:
- poetry==2.4.1
pass_filenames: true
files: 'pyproject\.toml$'
- id: pyproject-use-version-ranges
name: avoid using carets for version ranges
description: 'Avoid using carets for version ranges'
entry: '\^'
language: pygrep
types: [toml]
files: 'pyproject.toml$'
- id: pytest-fixtures-require-scope
name: ensure pytest fixture scopes are explicitly set
description: 'Ensure we explicitly set pytest fixture scopes'
entry: '@pytest\.fixture( |\n|(\(\)))'
language: pygrep
types: [python]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-no-eval
- id: python-no-log-warn
- id: python-use-type-annotations
# rst
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
# json
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.38.0
hooks:
- id: check-circle-ci
- id: check-github-workflows
- id: check-renovate
language: python
additional_dependencies:
- pyjson5==2.0.1
files: >
(?x)^(
renovate\.(json|json5)|
\.(github|gitlab)/renovate\.(json|json5)|
\.renovaterc|
\.renovaterc\.(json|json5)|
renovate/.*\.(json|json5)
)$
# docker
- repo: https://github.com/AleksaC/hadolint-py
rev: v2.14.0
hooks:
- id: hadolint
args:
# TODO: get renovate to work with apt pinning
- --ignore=DL3008
# TODO: get renovate to work with apk pinning
- --ignore=DL3018
# https://github.com/hadolint/hadolint/wiki/DL3025
# Breaks `exec` usage
- --ignore=DL3025
# https://github.com/hadolint/hadolint/issues/497
- --ignore=DL3042
# javascript
- repo: https://github.com/pre-commit/mirrors-fixmyjs
rev: v2.0.0
hooks:
- id: fixmyjs
exclude: '(.*.min.js)'
# TODO: enable me
# - repo: https://github.com/pre-commit/mirrors-jshint
# rev: v2.13.6
# hooks:
# - id: jshint
# exclude: '(.*.min.js)'
# shell
# TODO: enable me
# - repo: https://github.com/openstack/bashate
# rev: 2.1.1
# hooks:
# - id: bashate
# args: [--max-line-length=80]
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.11.0.1
hooks:
- id: shellcheck
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: script-must-not-have-extension
exclude: 'slack-notifier/send-deploy-notif.sh'