forked from teemtee/tmt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
269 lines (249 loc) · 8.93 KB
/
.pre-commit-config.yaml
File metadata and controls
269 lines (249 loc) · 8.93 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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
---
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v6.0.0"
hooks:
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: no-commit-to-branch
args: [--branch, main]
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.19.1"
hooks:
- id: mypy
language: python # Required for Renovate additional_dependencies
language_version: "3.9"
# TODO: find out how to amend mypy, pyright, pre-commit and package requirements.
# Apparently, there is no easy way to avoid some level of duplication of
# information when the package is *not* installed, which is the case of tmt
# & pre-commit in our setup.
#
# For now, we simply copy & paste from pyproject.toml :(
additional_dependencies:
- "importlib-metadata>=3.6.0; python_version < '3.10'"
- "importlib-resources; python_version < '3.12'"
- "click>=8.0.3"
- "docutils>=0.16"
- "fmf>=1.7.0"
- "jinja2>=2.11.3"
- "packaging>=20"
- "pint>=0.16.1"
- "pydantic>=1.10.14"
# Missing python3.14 pre-compiled wheels among other issues
- "pydantic>=2.12.0a1; python_version >= '3.14'"
- "pygments>=2.7.4"
- "requests>=2.25.1"
- "ruamel.yaml>=0.16.6"
- "urllib3>=1.26.5, <3.0"
- "jira>=3.5.0, <4"
# report-junit
- "lxml>=4.6.5"
- "typing-extensions>=4.12.2; python_version < '3.13'"
- "pytest"
- "requre"
# Do not install *types-click* - it's not recommended with Click 8 & newer,
# which is the version a developer encounters given the requirements are not
# frozen.
- "types-Markdown"
# prevent conflict between types-requests and urllib3
- "types-requests<2.32.4.20260108; python_version < '3.10'"
- "types-requests; python_version >= '3.10'"
- "types-setuptools"
- "types-jsonschema"
- "types-urllib3"
- "types-jinja2"
- "types-babel"
- "types-docutils"
- "types-lxml"
pass_filenames: false
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.408
hooks:
- id: pyright
language: python # Required for Renovate additional_dependencies
language_version: "3.9"
# TODO: find out how to amend mypy, pyright, pre-commit and package requirements.
# Apparently, there is no easy way to avoid some level of duplication of
# information when the package is *not* installed, which is the case of tmt
# & pre-commit in our setup.
#
# For now, we simply copy & paste from pyproject.toml :(
additional_dependencies:
- "importlib-metadata>=3.6.0; python_version < '3.10'"
- "importlib-resources; python_version < '3.12'"
- "click>=8.0.3"
- "docutils>=0.16"
- "fmf>=1.7.0"
- "jinja2>=2.11.3"
- "packaging>=20"
- "pint>=0.16.1"
- "pydantic>=1.10.14"
# Missing python3.14 pre-compiled wheels among other issues
- "pydantic>=2.12.0a1; python_version >= '3.14'"
- "pygments>=2.7.4"
- "requests>=2.25.1"
- "ruamel.yaml>=0.16.6"
- "urllib3>=1.26.5, <3.0"
- "jira>=3.5.0, <4"
# report-junit
- "lxml>=4.6.5"
- "typing-extensions>=4.9.0; python_version < '3.13'"
- "pytest"
- "requre"
# Do not install *types-click* - it's not recommended with Click 8 & newer,
# which is the version a developer encounters given the requirements are not
# frozen.
- "types-Markdown"
# prevent conflict between types-requests and urllib3
- "types-requests<2.32.4.20260108; python_version < '3.10'"
- "types-requests; python_version >= '3.10'"
- "types-setuptools"
- "types-jsonschema"
- "types-urllib3"
- "types-jinja2"
- "types-babel"
- "types-docutils"
- "types-lxml"
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: "0.37.0"
hooks:
- id: check-metaschema
name: "Check JSON schemas validity"
files: ^tmt/schemas/.*\.yaml
- repo: https://github.com/adrienverge/yamllint
rev: v1.38.0
hooks:
- id: yamllint
files: >
(?x)^(
\.pre-commit-hooks\.yaml|
\.hadolint\.yaml|
\.packit\.yaml|
\.readthedocs\.yaml|
\.pre-commit-config\.yaml|
tmt/config/themes/.+\.yaml|
tmt/steps/prepare/feature/.+\.yaml|
tmt/schemas/.+\.yaml|
tmt/steps/provision/mrack/.+\.yaml|
tests/policy/policies/.+/.+\.yaml
)$
- repo: https://github.com/ansible-community/ansible-lint.git
rev: v26.2.0
hooks:
- id: ansible-lint
language: python # Required for Renovate additional_dependencies
args:
- ansible/
- examples/ansible/
- examples/redis/ansible/
- tests/finish/ansible/data/
- tests/run/worktree/data/ansible/
- tmt/steps/prepare/feature/
- --profile=production
- --exclude=examples/redis/ansible/tasks/redis.yml
# redis.yml example requires posix module to be installed
# in order to be parsed by ansible-lint
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.15.4
hooks:
- id: ruff-check
args:
- "--fix"
- "--show-fixes"
- id: ruff-format
- repo: https://github.com/teemtee/tmt.git
rev: 1.68.0
hooks:
- id: tmt-lint
language: python # Required for Renovate additional_dependencies
additional_dependencies:
- "docutils>=0.16" # 0.16 is the current one available for RHEL9
- "packaging>=20" # 20 seems to be available with RHEL8
- "pint>=0.16.1"
- "pydantic>=1.10.14"
# Missing python3.14 pre-compiled wheels among other issues
- "pydantic>=2.12.0a1; python_version >= '3.14'"
- "pygments>=2.7.4" # 2.7.4 is the current one available for RHEL9
# Help installation by reducing the set of inspected botocore release.
# There is *a lot* of them, and hatch might fetch many of them.
- "botocore>=1.25.10" # 1.25.10 is the current one available for RHEL9
- "typing-extensions>=4.9.0; python_version < '3.13'"
- "fmf>=1.6.0"
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
additional_dependencies:
- tomli # Required for python < 3.11
- repo: https://github.com/djlint/djLint
rev: v1.36.4
hooks:
- id: djlint
files: "\\.j2"
types_or: ["jinja"]
- repo: https://github.com/aristanetworks/j2lint.git
rev: v1.2.0
hooks:
- id: j2lint
args:
# j2lint does not consume pyproject.toml
- "--ignore"
- jinja-statements-indentation
- jinja-variable-lower-case
- single-statement-per-line
- "--"
- repo: https://github.com/AleksaC/hadolint-py
rev: v2.14.0
hooks:
- id: hadolint
files: ^containers/.*
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
# Local shellcheck for developers - keep exclusions in sync with
# .github/workflows/shellcheck.yml
exclude: >
(?x)^(
tests/.*|
examples/.*|
tmt/steps/execute/scripts/.*\.sh\.j2|
tmt/templates/.*
)$
- repo: https://github.com/pycqa/flake8
rev: "7.3.0"
hooks:
- id: flake8
additional_dependencies:
- flake8-rst-docstrings
args:
- '--select'
- 'RST'
# The following are just a subset of what Sphinx defines.
# Listing them for flake8-rst-docstrings, in the future we
# may need to add more as needed.
- '--rst-roles'
- 'py:class,py:attr,py:func,py:meth,py:exc,py:mod,py:const,py:data,py:member,ref,tmt:story'
- '--rst-directives'
- 'versionadded,versionchanged'
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.10.7
hooks:
# Keep pyproject.toml and uv.lock in sync
- id: uv-lock
# Keep pylock.toml in sync
- id: uv-export
args:
- "--frozen"
- "--format=pylock.toml"
- "--output-file=pylock.toml"
- "--all-extras"
- "--quiet"