-
Notifications
You must be signed in to change notification settings - Fork 1
/
.pre-commit-hooks.yaml
387 lines (387 loc) · 12.4 KB
/
.pre-commit-hooks.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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
---
- id: black
name: black
description: black - Python Code Formatter
language: python
entry: black
files: \.(py)$
- id: circleci-config-pack
name: CircleCI config pack
description: Pack the config, creating the config.yml file
entry: ls_pre_commit_hooks/circleci-config-pack.sh
language: script
files: ^.circleci/config/
pass_filenames: false
- id: circleci-config-validate
name: CircleCI config validation
description: Test if the CircleCI config is well formed.
entry: ls_pre_commit_hooks/circleci-config-validate.sh
language: script
files: ^.circleci/config.yml$
- id: policy-bot-config-validate
name: Policy-Bot policy.yml validation
description: Validate the policy.yml file used by policy-bot
entry: ls_pre_commit_hooks/validate-policy-bot-yaml.sh
language: script
files: ^.policy.yml$
- id: detect-secrets
name: Detect secrets
description: Detects high entropy strings that are likely to be passwords.
language: python
entry: detect-secrets-hook
args: ["--base64-limit", "4.5", "--hex-limit", "3"]
files: .*
- id: flake8
name: flake8
description: flake8 - Python style guide enforcement
language: python
entry: flake8
files: \.py$
- id: ruff
name: ruff
description: ruff - Python linting
language: python
entry: ruff --fix
files: \.py$
- id: ruff-format
name: ruff-format
description: ruff-format - Python formatting
language: python
entry: ruff format
files: \.py$
- id: google-java-code-format
name: Format Java with Google formatter
entry: ls_pre_commit_hooks/google-java-code-format.sh
language: script
types: [text]
files: \.(java)$
stages: [commit, push, manual]
require_serial: true
- id: isort
name: isort
description: isort - Sorting Python imports
language: python
entry: isort
files: \.(py)$
- id: mypy
name: mypy
description: Executes static type checking for python
entry: mypy
language: python
'types': [python]
args: ["--ignore-missing-imports", "--scripts-are-modules"]
require_serial: true
additional_dependencies: []
- id: poetry-pytest
name: Pytest within poetry shell
description: Use poetry to run pytest
entry: ls_pre_commit_hooks/poetry-pytest.sh
language: script
pass_filenames: false
always_run: true
- id: poetry-run
name: General poetry run command
description: Use poetry to run any check command
entry: ls_pre_commit_hooks/poetry-run.sh
language: script
pass_filenames: false
always_run: true
- id: pylint
name: pylint
description: pylint - It's not just a linter that annoys you!
language: python
entry: pylint
files: \.(py)$
require_serial: true
- id: shellcheck
name: Test shell scripts with shellcheck
description: Shell scripts conform to shellcheck
entry: submodule_syntaqx_git_hooks/hooks/shellcheck.sh
language: script
types: [shell]
exclude_types: [csh, perl, python, ruby, tcsh, zsh]
args: [-e, SC1091]
- id: shfmt
name: Check shell style with shfmt
language: script
entry: submodule_syntaqx_git_hooks/hooks/shfmt.sh
types: [shell]
exclude_types: [csh, perl, python, ruby, tcsh, zsh]
args: ["-l", "-i", "2", "-ci"]
- id: tidy-xml-format
name: Format XML with Tidy
entry: ls_pre_commit_hooks/tidy-xml-format.sh
language: script
types: [text]
files: \.(xml)$
stages: [commit, push, manual]
- id: yamllint
name: yamllint
description: This hook runs yamllint.
entry: yamllint
language: python
types: [file, yaml]
- id: checkstyle
name: checkstyle
description: |
Runs checkstyle style check with mvn.
mvn executable is expected to be installed.
entry: ls_pre_commit_hooks/maven-checkstyle.sh
language: script
pass_filenames: false
# pre-commit-hooks is installed as a dependency (in pyproject.toml), adding hooks from:
# https://github.com/pre-commit/pre-commit-hooks/blob/v4.1.0/.pre-commit-hooks.yaml
- id: check-added-large-files
name: check for added large files
description: prevents giant files from being committed.
entry: check-added-large-files
language: python
- id: check-ast
name: check python ast
description: simply checks whether the files parse as valid python.
entry: check-ast
language: python
types: [python]
- id: check-byte-order-marker
name: 'check BOM - deprecated: use fix-byte-order-marker'
description: forbids files which have a utf-8 byte-order marker.
entry: check-byte-order-marker
language: python
types: [text]
- id: check-builtin-literals
name: check builtin type constructor use
description: requires literal syntax when initializing empty or zero python builtin types.
entry: check-builtin-literals
language: python
types: [python]
- id: check-case-conflict
name: check for case conflicts
description: checks for files that would conflict in case-insensitive filesystems.
entry: check-case-conflict
language: python
- id: check-docstring-first
name: check docstring is first
description: checks a common error of defining a docstring after code.
entry: check-docstring-first
language: python
types: [python]
- id: check-executables-have-shebangs
name: check that executables have shebangs
description: ensures that (non-binary) executables have a shebang.
entry: check-executables-have-shebangs
language: python
types: [text, executable]
stages: [commit, push, manual]
- id: check-json
name: check json
description: checks json files for parseable syntax.
entry: check-json
language: python
types: [json]
- id: check-shebang-scripts-are-executable
name: check that scripts with shebangs are executable
description: ensures that (non-binary) files with a shebang are executable.
entry: check-shebang-scripts-are-executable
language: python
types: [text]
stages: [commit, push, manual]
- id: pretty-format-json
name: pretty format json
description: sets a standard for formatting json files.
entry: pretty-format-json
language: python
types: [json]
- id: check-merge-conflict
name: check for merge conflicts
description: checks for files that contain merge conflict strings.
entry: check-merge-conflict
language: python
types: [text]
- id: check-symlinks
name: check for broken symlinks
description: checks for symlinks which do not point to anything.
entry: check-symlinks
language: python
types: [symlink]
- id: check-toml
name: check toml
description: checks toml files for parseable syntax.
entry: check-toml
language: python
types: [toml]
- id: check-vcs-permalinks
name: check vcs permalinks
description: ensures that links to vcs websites are permalinks.
entry: check-vcs-permalinks
language: python
types: [text]
- id: check-xml
name: check xml
description: checks xml files for parseable syntax.
entry: check-xml
language: python
types: [xml]
- id: check-yaml
name: check yaml
description: checks yaml files for parseable syntax.
entry: check-yaml
language: python
types: [yaml]
- id: debug-statements
name: debug statements (python)
description: checks for debugger imports and py37+ `breakpoint()` calls in python source.
entry: debug-statement-hook
language: python
types: [python]
- id: destroyed-symlinks
name: detect destroyed symlinks
description: detects symlinks which are changed to regular files with a content of a path which that symlink was pointing to.
entry: destroyed-symlinks
language: python
types: [file]
- id: detect-aws-credentials
name: detect aws credentials
description: detects *your* aws credentials from the aws cli credentials file.
entry: detect-aws-credentials
language: python
types: [text]
- id: detect-private-key
name: detect private key
description: detects the presence of private keys.
entry: detect-private-key
language: python
types: [text]
- id: double-quote-string-fixer
name: fix double quoted strings
description: replaces double quoted strings with single quoted strings.
entry: double-quote-string-fixer
language: python
types: [python]
- id: end-of-file-fixer
name: fix end of files
description: ensures that a file is either empty, or ends with one newline.
entry: end-of-file-fixer
language: python
types: [text]
stages: [commit, push, manual]
- id: file-contents-sorter
name: file contents sorter
description: sorts the lines in specified files (defaults to alphabetical). you must provide list of target files as input in your .pre-commit-config.yaml file.
entry: file-contents-sorter
language: python
files: '^$'
- id: fix-byte-order-marker
name: fix utf-8 byte order marker
description: removes utf-8 byte order marker.
entry: fix-byte-order-marker
language: python
types: [text]
- id: fix-encoding-pragma
name: fix python encoding pragma
description: 'adds # -*- coding: utf-8 -*- to the top of python files.'
language: python
entry: fix-encoding-pragma
types: [python]
- id: forbid-new-submodules
name: forbid new submodules
description: prevents addition of new git submodules.
language: python
entry: forbid-new-submodules
types: [directory]
- id: mixed-line-ending
name: mixed line ending
description: replaces or checks mixed line ending.
entry: mixed-line-ending
language: python
types: [text]
- id: name-tests-test
name: python tests naming
description: this verifies that test files are named correctly.
entry: name-tests-test
language: python
files: (^|/)tests/.+\.py$
- id: no-commit-to-branch
name: "don't commit to branch"
entry: no-commit-to-branch
language: python
pass_filenames: false
always_run: true
- id: requirements-txt-fixer
name: fix requirements.txt
description: sorts entries in requirements.txt.
entry: requirements-txt-fixer
language: python
files: requirements.*\.txt$
- id: sort-simple-yaml
name: sort simple yaml files
description: sorts simple yaml files which consist only of top-level keys, preserving comments and blocks.
language: python
entry: sort-simple-yaml
files: '^$'
- id: trailing-whitespace
name: trim trailing whitespace
description: trims trailing whitespace.
entry: trailing-whitespace-fixer
language: python
types: [text]
stages: [commit, push, manual]
- id: plantuml-renderer
name: plantuml renderer
description: render plantuml file (*.puml) to svg image
language: script
entry: ls_pre_commit_hooks/plantuml-renderer.sh
files: '.*\.puml$'
- id: asyncapi-linter
name: lint asyncapi documents
description: lints asyncapi documents with spectral
entry: ls_pre_commit_hooks/openapi-linter.sh
args:
- asyncapi
language: script
files: '^apidoc/.+/asyncapi\.yaml$'
- id: openapi-linter
name: lint openapi documents
description: lints openapi documents with spectral
entry: ls_pre_commit_hooks/openapi-linter.sh
args:
- openapi
language: script
files: '^apidoc/.+/openapi\.yaml$'
- id: openapi-yaml-not-yml
name: Make sure openapi definitions end with .yaml
entry: It's YAML not YML
language: fail
files: '^apidoc/.*\.yml$'
- id: prettier-xml
name: prettier-xml
additional_dependencies:
- 'prettier@2.7.1'
- '@prettier/plugin-xml@2.2.0'
entry: prettier --write --list-different --ignore-unknown
language: node
files: \.xml$
args: ["--xml-whitespace-sensitivity", "ignore"]
- id: spotless-apply
name: spotless-apply
description: |
Runs spotless-apply with mvn.
mvn executable is expected to be installed.
entry: ls_pre_commit_hooks/spotless-apply.sh
language: script
pass_filenames: false
# Based on https://github.com/hadolint/hadolint/blob/024fd640378acd5d8218f77ec2c744826cdda5ce/.pre-commit-hooks.yaml
# But with a pinned version for the docker image
- id: hadolint-docker
name: Lint Dockerfiles
description: Runs hadolint Docker image to lint Dockerfiles
language: docker_image
types: ["dockerfile"]
entry: ghcr.io/hadolint/hadolint:v2.12.0 hadolint
# Based on https://github.com/hadolint/hadolint/blob/024fd640378acd5d8218f77ec2c744826cdda5ce/.pre-commit-hooks.yaml
# But with a script that downloads it and runs the binary
- id: hadolint-check
name: Lint Dockerfiles
description: Downloads and runs hadolint binary to lint Dockerfiles
language: script
types: ["dockerfile"]
entry: ls_pre_commit_hooks/hadolint-check.sh