Debian Codegraph @

.pre-commit-config.yaml

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