-
Notifications
You must be signed in to change notification settings - Fork 126
/
.pre-commit-config.yaml
190 lines (175 loc) · 6.94 KB
/
.pre-commit-config.yaml
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
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/hhatto/autopep8
rev: 'v2.3.1'
hooks:
- id: autopep8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v5.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.12.0"
hooks:
- id: mypy
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:
- "click>=8.0.3,!=8.1.4" # 8.1.3 / 8.1.6 TODO type annotations tmt.cli.Context -> click.core.Context click/issues/2558
- "docutils>=0.16" # 0.16 is the current one available for RHEL9
- "fmf>=1.3.0"
- "jinja2>=2.11.3" # 3.1.2 / 3.1.2
- "packaging>=20" # 20 seems to be available with RHEL8
- "pint>=0.16.1" # 0.16.1
- "pygments>=2.7.4" # 2.7.4 is the current one available for RHEL9
- "requests>=2.25.1" # 2.28.2 / 2.31.0
- "ruamel.yaml>=0.16.6" # 0.17.32 / 0.17.32
- "urllib3>=1.26.5, <2.0" # 1.26.16 / 2.0.4
- "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.31.0.7; 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
args: [--config-file=pyproject.toml]
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.385
hooks:
- id: pyright
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:
- "click>=8.0.3,!=8.1.4" # 8.1.3 / 8.1.6 TODO type annotations tmt.cli.Context -> click.core.Context click/issues/2558
- "docutils>=0.16" # 0.16 is the current one available for RHEL9
- "fmf>=1.3.0"
- "jinja2>=2.11.3" # 3.1.2 / 3.1.2
- "packaging>=20" # 20 seems to be available with RHEL8
- "pint>=0.16.1" # 0.16.1 / 0.19.x TODO: Pint 0.20 requires larger changes to tmt.hardware
- "pygments>=2.7.4" # 2.7.4 is the current one available for RHEL9
- "requests>=2.25.1" # 2.28.2 / 2.31.0
- "ruamel.yaml>=0.16.6" # 0.17.32 / 0.17.32
- "urllib3>=1.26.5, <2.0" # 1.26.16 / 2.0.4
- "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.31.0.7; 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.29.4"
hooks:
- id: check-metaschema
name: "Check JSON schemas validity"
files: ^tmt/schemas/.*\.yaml
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
files: ^tmt/schemas/.*\.yaml
- repo: https://github.com/ansible-community/ansible-lint.git
rev: v24.9.2
hooks:
- id: ansible-lint
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.7.0
hooks:
- id: ruff
args:
- '--fix'
- '--show-fixes'
- repo: https://github.com/teemtee/tmt.git
rev: 1.37.0
hooks:
- id: tmt-lint
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.20"
- "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'"
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
- tomli # Required for python < 3.11
- repo: https://github.com/djlint/djLint
rev: v1.35.2
hooks:
- id: djlint
files: "\\.j2"
types_or: ['jinja']
- repo: https://github.com/aristanetworks/j2lint.git
rev: v1.1.0
hooks:
- id: j2lint
args:
# j2lint does not consume pyproject.toml
- "--ignore"
- jinja-statements-indentation
- jinja-variable-lower-case
- single-statement-per-line
- "--"