Debian Codegraph @

core/.pre-commit-config.yaml

raw symbols SCIP
1 ---
2 minimum_pre_commit_version: "2.17"
3 default_stages: [commit]
4
5 ci:
6 skip: [mypy]
7
8 repos:
9 # ----------------------------------------------
10 # Meta hooks
11 # ----------------------------------------------
12
13 - repo: meta
14 hooks:
15 - id: identity
16 stages: [commit, manual]
17 - id: check-hooks-apply
18 stages: [manual]
19 - id: check-useless-excludes
20 stages: [manual]
21
22 # ----------------------------------------------
23 # File hooks
24 # ----------------------------------------------
25
26 # file checking out-of-the-box hooks
27 - repo: https://github.com/pre-commit/pre-commit-hooks
28 rev: c4a0b883114b00d8d76b479c820ce7950211c99b # frozen: v4.5.0
29 hooks:
30 - id: check-case-conflict
31 - id: check-shebang-scripts-are-executable
32
33 # ####################################################################################
34 #
35 # FORMATTING
36 #
37 # ####################################################################################
38
39 # ----------------------------------------------
40 # Python
41 # ----------------------------------------------
42
43 # ruff - python linter with fixing ability
44 - repo: https://github.com/astral-sh/ruff-pre-commit
45 rev: c22645f6b45188216151a407c040a9eec1795ab0 # frozen: v0.3.3
46 hooks:
47 - id: ruff
48 name: ruff (fix)
49 args: ["--fix-only", "--exit-non-zero-on-fix", "--config=pyproject.toml"]
50
51 # black - python formatter
52 - repo: https://github.com/psf/black
53 rev: 552baf822992936134cbd31a38f69c8cfe7c0f05 # frozen: 24.3.0
54 hooks:
55 - id: black
56 args: ["--safe"]
57
58 # blacken-docs - black for python code in docs (rst/md/tex)
59 - repo: https://github.com/asottile/blacken-docs
60 rev: 960ead214cd1184149d366c6d27ca6c369ce46b6 # frozen: 1.16.0
61 hooks:
62 - id: blacken-docs
63 exclude: testing|tests
64
65 # ----------------------------------------------
66 # JS / TS / HTML / CSS / MD / JSON / YAML
67 # ----------------------------------------------
68
69 # prettier - multi formatter
70 - repo: https://github.com/pre-commit/mirrors-prettier
71 rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8
72 hooks:
73 - id: prettier
74 additional_dependencies:
75 - "prettier@^3.2.4"
76
77 # ----------------------------------------------
78 # Spelling dict
79 # ----------------------------------------------
80
81 # Custom hook as python command
82 - repo: local
83 hooks:
84 - id: sort-spelling-dicts
85 name: Sort spelling_dict.txt files
86 description: Sort spelling_dict.txt files
87 language: python
88 entry: python
89 args:
90 - "-c"
91 - |
92 import pathlib;
93 import sys;
94 p = pathlib.Path(sys.argv[1]);
95 p.write_text("\n".join(sorted(set(p.read_text("utf-8").splitlines()))) + "\n", "utf-8")
96 files: "spelling_dict.txt"
97
98 # ----------------------------------------------
99 # General (code unspecific)
100 # ----------------------------------------------
101
102 # code unspecific out-of-the-box hooks
103 - repo: https://github.com/pre-commit/pre-commit-hooks
104 rev: c4a0b883114b00d8d76b479c820ce7950211c99b # frozen: v4.5.0
105 hooks:
106 - id: end-of-file-fixer
107 stages: [commit]
108 - id: trailing-whitespace
109 stages: [commit]
110
111 # ####################################################################################
112 #
113 # LINTING
114 #
115 # ####################################################################################
116
117 # ----------------------------------------------
118 # General (code unspecific)
119 # ----------------------------------------------
120
121 - repo: local
122 hooks:
123 # Find TODO:|FIXME:|BUG: comments in all files
124 # Inline skip: `#i#` directly after the colon after the tag-word
125 - id: find-todos
126 name: "Find TODO:|FIXME:|BUG: comments"
127 description: "Check for TODO:|FIXME:|BUG: comments in all files"
128 language: pygrep
129 entry: '(^|//!?|#|<!--|;|/\*(\*|!)?|\.\.)\s*(TODO:|FIXME:|BUG:)(?!#i#)'
130 exclude: TODO
131
132 # code unspecific out-of-the-box hooks
133 - repo: https://github.com/pre-commit/pre-commit-hooks
134 rev: c4a0b883114b00d8d76b479c820ce7950211c99b # frozen: v4.5.0
135 hooks:
136 - id: check-merge-conflict
137 - id: detect-private-key
138
139 # ----------------------------------------------
140 # Python
141 # ----------------------------------------------
142
143 # ruff - python linter with fixing ability
144 - repo: https://github.com/astral-sh/ruff-pre-commit
145 rev: c22645f6b45188216151a407c040a9eec1795ab0 # frozen: v0.3.3
146 hooks:
147 - id: ruff
148 name: ruff (lint)
149 args: ["--config=pyproject.toml"]
150
151 # python specific out-of-the-box hooks
152 - repo: https://github.com/pre-commit/pre-commit-hooks
153 rev: c4a0b883114b00d8d76b479c820ce7950211c99b # frozen: v4.5.0
154 hooks:
155 - id: debug-statements
156 - id: fix-encoding-pragma
157 args: ["--remove"]
158 - id: name-tests-test
159
160 # several python code regex hooks
161 - repo: https://github.com/pre-commit/pygrep-hooks
162 rev: 3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316 # frozen: v1.10.0
163 hooks:
164 - id: python-check-blanket-noqa
165 - id: python-check-blanket-type-ignore
166 - id: python-check-mock-methods
167 - id: python-no-eval
168 - id: python-no-log-warn
169
170 # Lint hooks managed via tox envs b/c they need the pkg installed
171 - repo: local
172 hooks:
173 # mypy - python type checker
174 - id: mypy
175 name: mypy
176 description: run mypy over the installed package via tox
177 entry: tox
178 args: ["-e", "mypy"]
179 language: python
180 additional_dependencies: [tox]
181 types: [python]
182 pass_filenames: false
183 require_serial: true
184
185 # ----------------------------------------------
186 # Shell script
187 # ----------------------------------------------
188
189 # shellscript (via PyPI package)
190 - repo: https://github.com/shellcheck-py/shellcheck-py
191 rev: a23f6b85d0fdd5bb9d564e2579e678033debbdff # frozen: v0.10.0.1
192 hooks:
193 - id: shellcheck
194
195 # ----------------------------------------------
196 # reStructuredText
197 # ----------------------------------------------
198
199 # rstcheck - rst file checker
200 - repo: https://github.com/rstcheck/rstcheck
201 rev: 445861c31d8134562e723d77115721038de2e687 # frozen: v6.2.0
202 hooks:
203 - id: rstcheck
204 additional_dependencies: [sphinx]
205 exclude: testing
206 args: ["--config", ".rstcheck.project.cfg"]
207
208 # ----------------------------------------------
209 # Markdown
210 # ----------------------------------------------
211
212 # markdownlint - md file checker
213 - repo: https://github.com/DavidAnson/markdownlint-cli2
214 rev: 82c791e94c2e2ab2119437d61c722c8e0c20d6c9 # frozen: v0.12.1
215 hooks:
216 - id: markdownlint-cli2
217
218 # ----------------------------------------------
219 # TOML / YAML
220 # ----------------------------------------------
221
222 # JSON specific out-of-the-box hooks
223 - repo: https://github.com/pre-commit/pre-commit-hooks
224 rev: c4a0b883114b00d8d76b479c820ce7950211c99b # frozen: v4.5.0
225 hooks:
226 - id: check-toml
227 - id: check-yaml
228
229 # yamllint - yaml linter
230 - repo: https://github.com/adrienverge/yamllint
231 rev: 81e9f98ffd059efe8aa9c1b1a42e5cce61b640c6 # frozen: v1.35.1
232 hooks:
233 - id: yamllint