Skip to content

Commit 6e03252

Browse files
authored
[CI] Update and document the pre-commit hooks (#2411)
1 parent 06aa623 commit 6e03252

File tree

1 file changed

+58
-8
lines changed

1 file changed

+58
-8
lines changed

.pre-commit-config.yaml

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,23 @@ default_language_version:
2222
# force all unspecified Python hooks to run python3
2323
python: python3
2424
# force all unspecified Node hooks to run Node.js v22.17.0 LTS
25-
node: 22.17.0
25+
node: 22.20.0
2626
minimum_pre_commit_version: '3.2.0'
2727
repos:
2828
- repo: meta
2929
hooks:
3030
- id: identity
3131
name: run identity check
32+
description: check you have set your git identity
3233
- id: check-hooks-apply
3334
name: run check hooks apply
35+
description: check that all the hooks apply to the repository
3436
- repo: https://github.com/thlorenz/doctoc.git
3537
rev: v2.2.0
3638
hooks:
3739
- id: doctoc
38-
name: Add TOC for Markdown and RST files
40+
name: add TOC for Markdown files
41+
description: automatically keeps your table of contents up to date
3942
files: ^README\.md$
4043
- repo: local
4144
hooks:
@@ -69,6 +72,7 @@ repos:
6972
files: (?i)\.zip$
7073
- id: check-makefiles-tabs
7174
name: check Makefiles files for tabs
75+
description: ensures that Makefiles are indented with tabs
7276
entry: ./scripts/pre-commit/check_makefiles_for_tabs.sh # Path to your script
7377
language: system
7478
files: '(?i)makefile$'
@@ -80,11 +84,13 @@ repos:
8084
hooks:
8185
- id: chmod
8286
name: set file permissions
87+
description: manual hook to be run by macOS or Linux users for a full repository clean up
8388
args: ['644']
8489
files: \.md$
8590
stages: [manual]
8691
- id: insert-license
8792
name: add license for all .c files
93+
description: automatically adds a licence header to all C files that don't have a license header
8894
files: \.c$
8995
args:
9096
- --comment-style
@@ -94,6 +100,7 @@ repos:
94100
- --fuzzy-match-generates-todo
95101
- id: insert-license
96102
name: add license for all .h files
103+
description: automatically adds a licence header to all header files that don't have a license header
97104
files: \.h$
98105
args:
99106
- --comment-style
@@ -103,6 +110,7 @@ repos:
103110
- --fuzzy-match-generates-todo
104111
- id: insert-license
105112
name: add license for all Java files
113+
description: automatically adds a licence header to all Java files that don't have a license header
106114
files: \.java$
107115
args:
108116
- --comment-style
@@ -112,6 +120,7 @@ repos:
112120
- --fuzzy-match-generates-todo
113121
- id: insert-license
114122
name: add license for all Markdown files
123+
description: automatically adds a licence header to all Markdown files that don't have a license header
115124
files: \.md$
116125
args:
117126
- --comment-style
@@ -122,6 +131,7 @@ repos:
122131
exclude: ^docs/index\.md$|^\.github/pull_request_template\.md$|\.github/issue_template\.md$|^docs/blog/.*\.md$
123132
- id: insert-license
124133
name: add license for all Makefile files
134+
description: automatically adds a licence header to all Makefiles that don't have a license header
125135
files: ^Makefile$
126136
args:
127137
- --comment-style
@@ -131,6 +141,7 @@ repos:
131141
- --fuzzy-match-generates-todo
132142
- id: insert-license
133143
name: add license for all R files
144+
description: automatically adds a licence header to all R files that don't have a license header
134145
files: \.R$
135146
args:
136147
- --comment-style
@@ -140,6 +151,7 @@ repos:
140151
- --fuzzy-match-generates-todo
141152
- id: insert-license
142153
name: add license for all Scala files
154+
description: automatically adds a licence header to all Scala files that don't have a license header
143155
files: \.scala$
144156
args:
145157
- --comment-style
@@ -149,6 +161,7 @@ repos:
149161
- --fuzzy-match-generates-todo
150162
- id: insert-license
151163
name: add license for all TOML files
164+
description: automatically adds a licence header to all TOML files that don't have a license header
152165
files: \.toml$
153166
args:
154167
- --comment-style
@@ -158,6 +171,7 @@ repos:
158171
- --fuzzy-match-generates-todo
159172
- id: insert-license
160173
name: add license for all YAML files
174+
description: automatically adds a licence header to all YAML files that don't have a license header
161175
files: \.ya?ml$
162176
args:
163177
- --comment-style
@@ -167,6 +181,7 @@ repos:
167181
- --fuzzy-match-generates-todo
168182
- id: insert-license
169183
name: add license for all Python files
184+
description: automatically adds a licence header to all Python files that don't have a license header
170185
files: \.py$
171186
args:
172187
- --comment-style
@@ -176,6 +191,7 @@ repos:
176191
- --fuzzy-match-generates-todo
177192
- id: insert-license
178193
name: add license for all other files
194+
description: automatically adds a licence header to all other files that don't have a license header
179195
files: ^\.(editorconfig|gitattributes|prettierignore|prettierrc|shellcheckrc)$|^.*/\.gitignore$
180196
args:
181197
- --comment-style
@@ -184,12 +200,14 @@ repos:
184200
- .github/workflows/license-templates/LICENSE.txt
185201
- --fuzzy-match-generates-todo
186202
- repo: https://github.com/asottile/pyupgrade
187-
rev: v3.20.0
203+
rev: v3.21.0
188204
hooks:
189205
- id: pyupgrade
206+
name: run pyupgrade
207+
description: a tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language
190208
args: [--py37-plus]
191209
- repo: https://github.com/psf/black-pre-commit-mirror
192-
rev: 25.1.0
210+
rev: 25.9.0
193211
hooks:
194212
- id: black-jupyter
195213
name: run black-jupyter
@@ -219,7 +237,7 @@ repos:
219237
args: [--ignore-words=.github/linters/codespell.txt]
220238
exclude: ^docs/image|^spark/common/src/test/resources|^docs/usecases|^tools/maven/scalafmt|osmpbf/build|^docker/zeppelin|^docs-overrides
221239
- repo: https://github.com/gitleaks/gitleaks
222-
rev: v8.27.2
240+
rev: v8.28.0
223241
hooks:
224242
- id: gitleaks
225243
name: run gitleaks
@@ -234,7 +252,7 @@ repos:
234252
- id: rst-inline-touching-normal
235253
name: detect mistake of inline code touching normal text in rst
236254
- repo: https://github.com/pre-commit/pre-commit-hooks
237-
rev: v5.0.0
255+
rev: v6.0.0
238256
hooks:
239257
- id: check-ast
240258
name: run check-ast
@@ -268,24 +286,50 @@ repos:
268286
name: run check-toml
269287
description: check TOML files for syntax errors
270288
- id: check-vcs-permalinks
289+
name: run check-vcs-permalinks
290+
description: ensures that links to vcs websites are permalinks
271291
- id: check-xml
292+
name: run check-xml
293+
description: attempts to load all xml files to verify syntax
272294
- id: check-yaml
295+
name: run check-yaml
296+
description: attempts to load all yaml files to verify syntax
273297
exclude: ^mkdocs\.yml$
274298
- id: debug-statements
299+
name: run debug-statements
300+
description: check for debugger imports and py37+ `breakpoint()` calls in python source.
275301
- id: destroyed-symlinks
302+
name: run destroyed-symlinks
303+
description: detects symlinks which are changed to regular files with a content of a path which that symlink was pointing to
276304
- id: detect-aws-credentials
305+
name: run detect-aws-credentials
306+
description: checks for the existence of AWS secrets that you have set up with the AWS CLI
277307
args: [--allow-missing-credentials]
278308
- id: detect-private-key
309+
name: run detect-private-key
310+
description: checks for the existence of private keys
279311
- id: end-of-file-fixer
312+
name: run end-of-file-fixer
313+
description: makes sure files end in a newline and only a newline
280314
exclude: \.svg$|^docs/image|^spark/common/src/test/resources
281315
- id: file-contents-sorter
316+
name: run file-contents-sorter
317+
description: sort the lines in specified files (defaults to alphabetical)
282318
args: [--unique]
283319
files: ^\.github/linters/codespell\.txt$
284320
- id: fix-byte-order-marker
321+
name: run fix-byte-order-marker
322+
description: removes UTF-8 byte order marker
285323
- id: forbid-submodules
324+
name: run forbid-submodules
325+
description: forbids any submodules in the repository
286326
- id: mixed-line-ending
327+
name: run mixed-line-ending
328+
description: replaces or checks mixed line ending
287329
exclude: \.csv$
288330
- id: name-tests-test
331+
name: run name-tests-test
332+
description: verifies that test files are named correctly
289333
args: [--pytest-test-first]
290334
exclude: |
291335
(?x)^(
@@ -298,8 +342,12 @@ repos:
298342
python/tests/tools\.py
299343
)$
300344
- id: requirements-txt-fixer
345+
name: run requirements-txt-fixer
346+
description: sorts entries in the Python requirements files and removes incorrect entry for pkg-resources==0.0.0
301347
files: ^docker/requirements\.txt$
302348
- id: trailing-whitespace
349+
name: run trailing-whitespace
350+
description: trims trailing whitespace
303351
args: [--markdown-linebreak-ext=md]
304352
exclude: ^docs-overrides/main\.html$|\.Rd$
305353
- repo: https://github.com/igorshubovych/markdownlint-cli
@@ -313,7 +361,7 @@ repos:
313361
types: [markdown]
314362
files: \.(md|mdown|markdown)$
315363
- repo: https://github.com/shellcheck-py/shellcheck-py
316-
rev: v0.10.0.1
364+
rev: v0.11.0.1
317365
hooks:
318366
- id: shellcheck
319367
name: run shellcheck
@@ -336,7 +384,9 @@ repos:
336384
args: ['--fix', '-o', '4', '--strip', 'safe', '--alpha']
337385
stages: [manual]
338386
- repo: https://github.com/adamchainz/blacken-docs
339-
rev: 1.19.1
387+
rev: 1.20.0
340388
hooks:
341389
- id: blacken-docs
390+
name: run blacken-docs
391+
description: run `black` on python code blocks in documentation files
342392
additional_dependencies: [black==25.1.0]

0 commit comments

Comments
 (0)