-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
238 lines (236 loc) · 9.94 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
238 lines (236 loc) · 9.94 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
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
---
# prek Hook Priority System Explanation:
#
# prek (a fast Rust-based pre-commit alternative) executes hooks based on priority levels:
# 1. Ordering: Hooks are executed in ascending order of their priority value (lowest first).
# 2. Concurrency: Hooks with the SAME priority value are executed concurrently (in parallel),
# limited only by the global concurrency limit (typically the number of CPU cores).
# 3. Explicit vs. Implicit: Any hook without an explicit `priority` field is automatically
# assigned an implicit priority equal to its 0-based index in the flattened hook list.
# To avoid unexpected execution order when mixing, we explicitly define priorities
# for all hooks.
#
# In this configuration:
# - Priority 1: Meta hooks (e.g., identity, check-hooks-apply). These run first to verify
# the hook environment and setup before any files are processed.
# - Priorities 10-17: File-modifying and formatting hooks (e.g., end-of-file-fixer,
# trailing-whitespace, pretty-format-json). These are executed sequentially in a specific
# order to avoid write conflicts/race conditions, ensuring files are fully prepared and
# formatted before any validation.
# - Priority 100: All read-only validation and linting hooks (e.g., codespell, yamllint,
# check-json, shellcheck, actionlint). Since these do not modify any files, they are run
# in parallel to maximize performance and minimize pre-commit execution time.
default_stages: [pre-commit, pre-push]
default_language_version:
# force all unspecified Python hooks to run python3
python: python3
minimum_prek_version: '0.3.4'
repos:
- repo: meta
hooks:
- id: identity
priority: 1
description: A simple hook which prints all arguments passed to it, useful for debugging
- id: check-hooks-apply
priority: 1
description: Useful when testing new hooks to see if they apply to the repository
- repo: local
hooks:
- id: check-zip-file-is-not-committed
priority: 100
name: Check no Zip files are committed
description: Zip files are not allowed in the repository
language: fail
entry: |
Zip files are not allowed in the repository as they are hard to
track and have security implications. Please remove the zip file from the repository
files: (?i)\.zip$
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: ad1b27d73581aa16cca06fc4a0761fc563ffe8e8 # frozen: v1.5.6
hooks:
- id: chmod
priority: 17
name: set file permissions
description: manual hook to be run by macOS or Linux users for a full repository clean up
args: ['644']
files: \.md$
stages: [manual]
- repo: https://github.com/codespell-project/codespell
rev: 57b21406f092110c18776e39b0bda50d37c945c8 # frozen: v2.4.3
hooks:
- id: codespell
priority: 100
name: run codespell
description: Check spelling with codespell
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
hooks:
- id: check-case-conflict
priority: 100
description: Check for files with names that would conflict on a case-insensitive filesystem like MacOS HFS+ or Windows FAT
- id: check-executables-have-shebangs
priority: 100
description: Checks that non-binary executables have a proper shebang
- id: check-illegal-windows-names
priority: 100
description: Check for files that cannot be created on Windows
- id: check-json
priority: 100
description: Attempts to load all json files to verify syntax
- id: check-merge-conflict
priority: 100
description: Check for files that contain merge conflict strings
- id: check-shebang-scripts-are-executable
priority: 100
description: Checks that scripts with shebangs are executable
- id: check-vcs-permalinks
priority: 100
description: Ensures that links to vcs websites are permalinks
- id: check-xml
priority: 100
description: Attempts to load all xml files to verify syntax
- id: check-yaml
priority: 100
description: Attempts to load all yaml files to verify syntax
- id: destroyed-symlinks
priority: 100
description: Detects symlinks which are changed to regular files with a content of a path which that symlink was pointing to
- id: detect-aws-credentials
priority: 100
description: Checks for the existence of AWS secrets that you have set up with the AWS CLI
args: [--allow-missing-credentials]
- id: detect-private-key
priority: 100
description: Checks for the existence of private keys
- id: end-of-file-fixer
priority: 10
description: Makes sure files end in a newline and only a newline
- id: file-contents-sorter
priority: 15
description: sort the lines in specified files (defaults to alphabetical)
args: [--unique]
files: ^\.github/linters/codespell\.txt$
- id: fix-byte-order-marker
priority: 13
description: removes UTF-8 byte order marker
- id: forbid-submodules
priority: 100
description: Forbids any submodules in the repository
- id: mixed-line-ending
priority: 12
description: replaces or checks mixed line ending
- id: pretty-format-json
priority: 14
description: checks that all your JSON files are pretty
args: [--autofix, --no-sort-keys]
- id: trailing-whitespace
priority: 11
description: Trims trailing whitespace
args: [--markdown-linebreak-ext=md]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: 5b5dddc4fb0f83c3ea1fc5616fa63e115dce83e0 # frozen: v0.49.1
hooks:
- id: markdownlint
priority: 100
name: run markdownlint
description: check Markdown files with markdownlint
args: [--config=.github/linters/.markdown-lint.yml]
exclude: ^\.github/.*$
types: [markdown]
files: \.md$
- repo: https://github.com/adrienverge/yamllint
rev: cba56bcde1fdd01c1deb3f945e69764c291a6530 # frozen: v1.38.0
hooks:
- id: yamllint
priority: 100
name: run yamllint
description: check YAML files with yamllint
args: [--strict, -c=.github/linters/.yaml-lint.yml]
types: [yaml]
files: \.ya?ml$
- repo: https://github.com/gitleaks/gitleaks
rev: 83d9cd684c87d95d656c1458ef04895a7f1cbd8e # frozen: v8.30.1
hooks:
- id: gitleaks
priority: 100
name: run gitleaks
description: check for secrets with gitleaks
- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: 451b56af716f9f0d0c2b816503a3fd0cf8b036fa # frozen: v1.29.0
hooks:
- id: zizmor
priority: 100
name: run zizmor
description: zizmor is a static analysis tool for GitHub Actions
# args: [--config=.github/linters/zizmor.yml]
files: ^\.github/workflows/.*$
types: [yaml]
- repo: https://github.com/rhysd/actionlint
rev: 914e7df21a07ef503a81201c76d2b11c789d3fca # frozen: v1.7.12
hooks:
- id: actionlint
priority: 100
name: run actionlint
description: actionlint is a static checker for GitHub Actions workflow files
- repo: https://github.com/tcort/markdown-link-check
rev: 275c27c5035a5b4a656fe0e21a4c1403c118c767 # frozen: v3.15.0
hooks:
- id: markdown-link-check
priority: 100
name: run markdown-link-check
description: checks all of the hyperlinks in a Markdown text to determine if they are alive or dead
args: [--config=.github/linters/mlc_config.json, -q]
types: [markdown]
files: \.md$
- repo: https://github.com/oxipng/oxipng
rev: 340cd9878d8d8289f09fa101b48a8f5f0b7783f4 # frozen: v10.2.0
hooks:
- id: oxipng
priority: 16
name: run oxipng
description: check PNG files with oxipng
args: ['--fix', '-o', '4', '--strip', 'safe', '--alpha']
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 12e63946db2c5cfcc9030fac21c3883ba88c6ed8 # frozen: 0.38.0
hooks:
- id: check-citation-file-format
priority: 100
name: run check-citation-file-format
description: validate citation file format
files: ^CITATION\.cff$
- id: check-dependabot
priority: 100
name: validate dependabot.yml
description: ensures the dependabot config file is valid
files: ^\.github/dependabot\.yml$
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: 745eface02aef23e168a8afb6b5737818efbea95 # frozen: v0.11.0.1
hooks:
- id: shellcheck
priority: 100
name: run shellcheck
description: check Shell scripts with shellcheck
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: e8b4e28241a9ae8296ba6e4a491b5da4eda73283 # frozen: 3.11.1
hooks:
- id: editorconfig-checker
priority: 100
name: run editorconfig-checker
description: a tool to verify that your files are in harmony with your .editorconfig
alias: ec