-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.pre-commit-hooks.yaml
More file actions
127 lines (127 loc) · 4.55 KB
/
.pre-commit-hooks.yaml
File metadata and controls
127 lines (127 loc) · 4.55 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
---
# cspell: ignore ansiblelint tombi
# hooks that rely on uv to track dependencies instead of pre-commit hooks
# Order matters: faster hooks first, also auto-formatters being prioritized
- id: toml
# keep name lowercase for consistency with other hook names
name: toml
description: Reformat toml files
entry: sh -c 'uv run -q --group=lint tombi format'
language: system
pass_filenames: false
types_or: [toml]
- id: md
name: markdown (md)
description: Runs markdownlint-cli2 with fix
language: node
language_version: "24"
pass_filenames: false
types: [markdown]
entry: npm exec -- markdownlint-cli2 --fix "**/*.md" "#node_modules"
- id: ruff
name: ruff
language: system
types_or: [python, pyi, jupyter]
pass_filenames: false
description: This hook runs ruff check and ruff format
entry: sh -c "uv run -q --group=lint ruff check --force-exclude && uv run -q --group=lint ruff format --force-exclude"
- id: mypy
name: mypy
description: This hook runs mypy
entry: sh -c 'uv run -q --all-extras --group=lint -m mypy .'
language: system
types_or: [python, pyi]
pass_filenames: false
- id: pylint
name: pylint
description: This hook runs pylint
entry: sh -c 'uv run -q --all-extras --group=lint -m pylint --score=n .'
language: system
types_or: [python, pyi]
require_serial: true
pass_filenames: false
- id: pyright
name: pyright
description: This hook runs pyright
entry: sh -c 'uv run -q --group=lint -m pyright .'
language: system
types_or: [python, pyi]
pass_filenames: false
- id: ansible-lint
# keep name lowercase for consistency with other hook names
name: ansible-lint
description: This hook runs ansible-lint --fix
# for ansible-lint in particular we want to for use of python>=3.13 to ensure
# that latest ansible-core will be installed. Always use --isolated when
# you mention custom python version to avoid accidentally recreating current venv
entry: sh -c 'uv run -q --isolated --python=">=3.13,<3.14" --group=lint -m ansiblelint --fix -v --force-color'
language: system
pass_filenames: false
- id: shellcheck
name: shellcheck
language: system
description: Test shell scripts with shellcheck
# https://github.com/koalaman/shellcheck/issues/143
entry: uv run -q --group lint shellcheck
types: [shell]
pass_filenames: true
require_serial: true # shellcheck can detect sourcing this way
- id: codespell
name: codespell
language: system
description: Test shell scripts with shellcheck
entry: sh -c 'uv tool run codespell[toml] --check-hidden --check-filenames'
types: [text]
require_serial: true # shellcheck can detect sourcing this way
pass_filenames: false # otherwise ignore option will not be used
- id: yamllint
name: yamllint
language: system
files: \.(yaml|yml)$
types: [file, yaml]
pass_filenames: false
entry: sh -c 'uv run -q --group lint yamllint --strict .'
- id: cspell
name: cspell + remove unused and sort dictionary
# see https://github.com/streetsidesoftware/cspell-cli/issues/686
# requires cspell-cli npm dependency
entry: bash
language: node
language_version: "24"
pass_filenames: false
always_run: true
args:
- "-euo"
- "pipefail"
- "-c"
- 'npm exec cspell-cli -- . --relative --no-progress --no-summary && { NEW_DICT=$(npm exec cspell-cli -- . --disable-dictionary=words --no-exit-code --words-only
--quiet --unique | LC_ALL=C sort); if [ "$NEW_DICT" != "$(cat .config/dictionary.txt 2>/dev/null || true)" ]; then echo "$NEW_DICT" > .config/dictionary.txt;
fi; }'
- id: codecov
name: Check codecov.yml
# https://superuser.com/a/1587813/3004
entry: >
bash -c '[ $(
curl --silent --retry 5 --retry-delay 30 -o /dev/stderr -w "%{http_code}" -X POST
--data-binary @codecov.yml https://codecov.io/validate
) -eq 200 ]'
language: system
files: "codecov.yml"
pass_filenames: false
- id: renovate-config-validator
name: renovate config validator
alias: renovate
entry: npm -y exec --package=renovate -- renovate-config-validator --strict
language: node
language_version: "24"
pass_filenames: false
files: "(renovate.json|renovate.json5|.renovaterc|.renovaterc.json5|.renovaterc.json)$"
args: []
# Do not add `renovate` a dependency because it does change too often and
# causing warnings about dependencies that we cannot fix. Keep it out.
- id: pydoclint
name: pydoclint
language: system
# This allows automatic reduction of the baseline file when needed.
entry: sh -ec "uv run -q --group lint pydoclint -q . && uv run -q --group lint pydoclint --generate-baseline=1 ."
pass_filenames: false