forked from cherrypy/cheroot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
256 lines (238 loc) · 5.82 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
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
---
ci:
autoupdate_schedule: quarterly
skip:
- stubtest
repos:
- repo: https://github.com/asottile/add-trailing-comma.git
rev: v3.0.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/Kludex/no-optional
rev: 0.4.0
hooks:
- id: no_optional
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
rev: v1.5.1
hooks:
- id: remove-tabs
- repo: https://github.com/Lucas-C/pre-commit-hooks-markup.git
rev: v1.0.1
hooks:
- id: rst-linter
exclude: >-
(?x)
CHANGES.rst
|
docs/
files: >-
^.*\.rst$
- repo: https://github.com/hhatto/autopep8.git
rev: >- # v2.0.2 does not yet have config, maybe v2.0.3 will, SHA for now
5b9110ba53fecd60cd3091fb66d808e8ced3b2e8
hooks:
- id: autopep8
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v4.4.0
hooks:
# Side-effects:
- id: trailing-whitespace
- id: check-merge-conflict
- id: double-quote-string-fixer
- id: end-of-file-fixer
# disabled because it doesn't make sense to change pip-tools-managed files
# - id: requirements-txt-fixer
# exclude: >-
# (?x)
# ^
# requirements/[^/]+.txt
# $
# files: >-
# (?x)
# ^
# requirements/[^/]+.in
# $
# Non-modifying checks:
- id: name-tests-test
args:
- --django
exclude: cheroot/test/(helper|webtest|_pytest_plugin).py
files: cheroot/test/.+\.py$
- id: check-added-large-files
- id: check-byte-order-marker
- id: check-case-conflict
# disabled due to pre-commit/pre-commit-hooks#159
# - id: check-docstring-first
- id: check-json
- id: check-symlinks
- id: check-yaml
args:
- --unsafe
- id: detect-private-key
# Heavy checks:
- id: check-ast
- id: debug-statements
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.32.0
hooks:
- id: yamllint
types:
- file
- yaml
args:
- --strict
- repo: https://github.com/PyCQA/flake8.git
rev: 6.0.0
hooks:
- id: flake8
alias: flake8-no-wps
name: flake8 WPS-excluded
additional_dependencies:
- darglint ~= 1.8.1
- flake8-2020 ~= 1.7.0
- flake8-annotations ~= 2.9.1; python_version >= "3.7"
- flake8-annotations ~= 2.7.0; python_version < "3.7"
- flake8-docstrings ~= 1.6.0
- flake8-length ~= 0.3.0
- flake8-logging-format ~= 0.7.5
- flake8-pytest-style ~= 1.6.0
- flake8-spellcheck ~= 0.28.0; python_version >= "3.8"
- flake8-spellcheck ~= 0.26.0; python_version < "3.8"
language_version: python3
- repo: https://github.com/PyCQA/flake8.git
# NOTE: This is kept at v4 for until WPS starts supporting flake v5.
rev: 4.0.1 # enforce-version: 4.0.1
hooks:
- id: flake8
alias: flake8-only-wps
name: flake8 WPS-only
args:
- --select
- WPS
additional_dependencies:
- wemake-python-styleguide ~= 0.17.0
language_version: python3
- repo: https://github.com/Lucas-C/pre-commit-hooks-lxml.git
rev: v1.1.0
hooks:
- id: forbid-html-img-without-alt-text
- repo: https://github.com/pre-commit/mirrors-mypy.git
rev: v1.4.1
hooks:
- id: mypy
alias: mypy-py38
name: MyPy, for Python 3.8
additional_dependencies:
- lxml
- types-backports
- types-pyOpenSSL
- types-requests
args:
- --install-types
- --non-interactive
- --python-version=3.8
- --txt-report=.tox/.tmp/.mypy/python-3.8
- cheroot/
pass_filenames: false
- id: mypy
alias: mypy-py310
name: MyPy, for Python 3.10
additional_dependencies:
- lxml
- types-backports
- types-pyOpenSSL
- types-requests
args:
- --install-types
- --non-interactive
- --python-version=3.10
- --txt-report=.tox/.tmp/.mypy/python-3.10
- cheroot/
pass_filenames: false
- id: mypy
alias: mypy-py312
name: MyPy, for Python 3.12
additional_dependencies:
- lxml
- types-backports
- types-pyOpenSSL
- types-requests
args:
- --install-types
- --non-interactive
- --python-version=3.12
- --txt-report=.tox/.tmp/.mypy/python-3.12
- cheroot/
pass_filenames: false
- repo: local
hooks:
- id: stubtest
name: MyPy stubtest
language: system
entry: stubtest
args:
- cheroot
- --mypy-config-file=mypy.ini
- --allowlist=stubtest_allowlist.txt
pass_filenames: false
types_or:
- python
- text
files: >-
(?x)
^
(
.*\.pyi?
|
cheroot/py\.typed
|
stubtest_allowlist\.txt
)
$
- repo: https://github.com/PyCQA/pylint.git
rev: v2.15.9
hooks:
- id: pylint
additional_dependencies:
- jaraco.context
- jaraco.functools
- jaraco.text
- more_itertools
- portend
- pylint-pytest < 1.1.0
- pypytools
- requests_toolbelt
- requests_unixsocket
- Sphinx
- repo: local
hooks:
- id: enforced-flake8-version
name: Verify that enforced flake8 version stays unchanged
description: >-
This is a sanity check and fixer that makes sure that
the `flake8` version in this file remains matching the
corresponding request in the `# enforce-version` comment.
# Using Python here because using
# shell test does not always work in CIs:
entry: >-
python -c 'import pathlib, re, sys;
pre_commit_config = pathlib.Path(sys.argv[1]);
cfg_txt = pre_commit_config.read_text();
new_cfg_txt = re.sub(
r"(?P<spaces>\s+)rev:\s(?:\d+\.\d+\.\d+)\s{0,2}"
r"#\senforce-version:\s(?P<enforced_version>\d+\.\d+\.\d+)"
r"[ \t\f\v]*",
r"\g<spaces>rev: \g<enforced_version> "
r"# enforce-version: \g<enforced_version>",
cfg_txt,
);
cfg_txt != new_cfg_txt and
pre_commit_config.write_text(new_cfg_txt)
'
pass_filenames: true
language: system
files: >-
^\.pre-commit-config\.ya?ml$
types:
- yaml
...