@@ -6,13 +6,13 @@ minimum_pre_commit_version: '2.8.2'
6
6
default_language_version :
7
7
python : python3
8
8
9
- default_stages : [commit]
9
+ default_stages : [pre- commit]
10
10
11
11
12
12
repos :
13
13
# General file checks and fixers
14
14
- repo : https://github.com/pre-commit/pre-commit-hooks
15
- rev : v4.6 .0
15
+ rev : v5.0 .0
16
16
hooks :
17
17
- id : mixed-line-ending
18
18
name : " Normalize mixed line endings"
43
43
name : " Check YAML"
44
44
45
45
- repo : https://github.com/psf/black-pre-commit-mirror
46
- rev : 24.4.2
46
+ rev : 24.10.0
47
47
hooks :
48
48
- id : black
49
49
name : " Format with Black"
53
53
files : ' ^(peps/conf\.py|pep_sphinx_extensions/tests/.*)$'
54
54
55
55
- repo : https://github.com/astral-sh/ruff-pre-commit
56
- rev : v0.5.1
56
+ rev : v0.7.0
57
57
hooks :
58
58
- id : ruff
59
59
name : " Lint with Ruff"
@@ -62,13 +62,13 @@ repos:
62
62
files : ' ^pep_sphinx_extensions/tests/'
63
63
64
64
- repo : https://github.com/tox-dev/tox-ini-fmt
65
- rev : 1.3 .1
65
+ rev : 1.4 .1
66
66
hooks :
67
67
- id : tox-ini-fmt
68
68
name : " Format tox.ini"
69
69
70
70
- repo : https://github.com/sphinx-contrib/sphinx-lint
71
- rev : v0.9.1
71
+ rev : v1.0.0
72
72
hooks :
73
73
- id : sphinx-lint
74
74
name : " Sphinx lint"
@@ -98,134 +98,10 @@ repos:
98
98
# Local checks for PEP headers and more
99
99
- repo : local
100
100
hooks :
101
- # # Hook to run "check-peps.py"
102
- # - id: "check-peps"
103
- # name: "Check PEPs for metadata and content enforcement"
104
- # entry: "python check-peps.py"
105
- # language: "system"
106
- # files: "^pep-\d{4}\.(rst|txt)$"
107
- # require_serial: true
108
-
109
- - id : check-required-headers
110
- name : " PEPs must have all required headers"
111
- language : pygrep
112
- entry : ' (?-m:^PEP:(?=[\s\S]*\nTitle:)(?=[\s\S]*\nAuthor:)(?=[\s\S]*\nStatus:)(?=[\s\S]*\nType:)(?=[\s\S]*\nCreated:))'
113
- args : ['--negate', '--multiline']
114
- files : ' ^peps/pep-\d+\.rst$'
115
-
116
- - id : check-header-order
117
- name : " PEP header order must follow PEP 12"
118
- language : pygrep
119
- entry : ' ^PEP:[^\n]+\nTitle:[^\n]+\n(Version:[^\n]+\n)?(Last-Modified:[^\n]+\n)?Author:[^\n]+\n( +\S[^\n]+\n)*(Sponsor:[^\n]+\n)?((PEP|BDFL)-Delegate:[^\n]*\n)?(Discussions-To:[^\n]*\n)?Status:[^\n]+\nType:[^\n]+\n(Topic:[^\n]+\n)?(Content-Type:[^\n]+\n)?(Requires:[^\n]+\n)?Created:[^\n]+\n(Python-Version:[^\n]*\n)?(Post-History:[^\n]*\n( +\S[^\n]*\n)*)?(Replaces:[^\n]+\n)?(Superseded-By:[^\n]+\n)?(Resolution:[^\n]*\n)?\n'
120
- args : ['--negate', '--multiline']
121
- files : ' ^peps/pep-\d+\.rst$'
122
-
123
- - id : validate-pep-number
124
- name : " 'PEP' header must be a number 1-9999"
125
- language : pygrep
126
- entry : ' (?-m:^PEP:(?:(?! +(0|[1-9][0-9]{0,3})\n)))'
127
- args : ['--multiline']
128
- files : ' ^peps/pep-\d+\.rst$'
129
-
130
- - id : validate-title
131
- name : " 'Title' must be 1-79 characters"
132
- language : pygrep
133
- entry : ' (?<=\n)Title:(?:(?! +\S.{1,78}\n(?=[A-Z])))'
134
- args : ['--multiline']
135
- files : ' ^peps/pep-\d+\.rst$'
136
- exclude : ' ^peps/pep-(0499)\.rst$'
137
-
138
- - id : validate-author
139
- name :
" 'Author' must be list of 'Name <[email protected] >, ...'"
140
- language : pygrep
141
- entry : ' (?<=\n)Author:(?:(?!((( +|\n {1,8})[^!#$%&()*+,/:;<=>?@\[\\\]\^_`{|}~]+( <[\w!#$%&'' *+\-/=?^_{|}~.]+(@| at )[\w\-.]+\.[A-Za-z0-9]+>)?)(,|(?=\n[^ ])))+\n(?=[A-Z])))'
142
- args : ["--multiline"]
143
- files : ' ^peps/pep-\d+\.rst$'
144
-
145
- - id : validate-sponsor
146
- name :
" 'Sponsor' must have format 'Name <[email protected] >'"
147
- language : pygrep
148
- entry : ' ^Sponsor:(?: (?! *[^!#$%&()*+,/:;<=>?@\[\\\]\^_`{|}~]+( <[\w!#$%&'' *+\-/=?^_{|}~.]+(@| at )[\w\-.]+\.[A-Za-z0-9]+>)?$))'
149
- files : ' ^peps/pep-\d+\.rst$'
150
-
151
- - id : validate-delegate
152
- name :
" 'Delegate' must have format 'Name <[email protected] >'"
153
- language : pygrep
154
- entry : ' ^(PEP|BDFL)-Delegate: (?:(?! *[^!#$%&()*+,/:;<=>?@\[\\\]\^_`{|}~]+( <[\w!#$%&'' *+\-/=?^_{|}~.]+(@| at )[\w\-.]+\.[A-Za-z0-9]+>)?$))'
155
- files : ' ^peps/pep-\d+\.rst$'
156
- exclude : ' ^peps/pep-(0451)\.rst$'
157
-
158
- - id : validate-discussions-to
159
- name : " 'Discussions-To' must be a thread URL"
160
- language : pygrep
161
- entry : ' ^Discussions-To: (?:(?!([\w\-]+@(python\.org|googlegroups\.com))|https://((discuss\.python\.org/t/([\w\-]+/)?\d+/?)|(mail\.python\.org/pipermail/[\w\-]+/\d{4}-[A-Za-z]+/[A-Za-z0-9]+\.html)|(mail\.python\.org/archives/list/[\w\-]+@python\.org/thread/[A-Za-z0-9]+/?))$))'
162
- files : ' ^peps/pep-\d+\.rst$'
163
-
164
- - id : validate-status
165
- name : " 'Status' must be a valid PEP status"
166
- language : pygrep
167
- entry : ' ^Status:(?:(?! +(Draft|Withdrawn|Rejected|Accepted|Final|Active|Provisional|Deferred|Superseded|April Fool!)$))'
168
- files : ' ^peps/pep-\d+\.rst$'
169
-
170
- - id : validate-type
171
- name : " 'Type' must be a valid PEP type"
172
- language : pygrep
173
- entry : ' ^Type:(?:(?! +(Standards Track|Informational|Process)$))'
174
- files : ' ^peps/pep-\d+\.rst$'
175
-
176
- - id : validate-topic
177
- name : " 'Topic' must be for a valid sub-index"
178
- language : pygrep
179
- entry : ' ^Topic:(?:(?! +(Governance|Packaging|Typing|Release)(, (Governance|Packaging|Typing|Release))*$))'
180
- files : ' ^peps/pep-\d+\.rst$'
181
-
182
- - id : validate-content-type
183
- name : " 'Content-Type' must be 'text/x-rst'"
184
- language : pygrep
185
- entry : ' ^Content-Type:(?:(?! +text/x-rst$))'
186
- files : ' ^peps/pep-\d+\.rst$'
187
-
188
- - id : validate-pep-references
189
- name : " `Requires`/`Replaces`/`Superseded-By` must be 'NNN' PEP IDs"
190
- language : pygrep
191
- entry : ' ^(Requires|Replaces|Superseded-By):(?:(?! *( (0|[1-9][0-9]{0,3})(,|$))+$))'
192
- files : ' ^peps/pep-\d+\.rst$'
193
-
194
- - id : validate-created
195
- name : " 'Created' must be a 'DD-mmm-YYYY' date"
196
- language : pygrep
197
- entry : ' ^Created:(?:(?! +([0-2][0-9]|(3[01]))-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(199[0-9]|20[0-9][0-9])$))'
198
- files : ' ^peps/pep-\d+\.rst$'
199
-
200
- - id : validate-python-version
201
- name : " 'Python-Version' must be a 'X.Y[.Z]` version"
202
- language : pygrep
203
- entry : ' ^Python-Version:(?:(?! *( [1-9]\.([0-9][0-9]?|x)(\.[1-9][0-9]?)?(,|$))+$))'
204
- files : ' ^peps/pep-\d+\.rst$'
205
-
206
- - id : validate-post-history
207
- name : " 'Post-History' must be '`DD-mmm-YYYY <Thread URL>`__, ...'"
208
- language : pygrep
209
- entry : ' (?<=\n)Post-History:(?:(?! ?\n|((( +|\n {1,14})(([0-2][0-9]|(3[01]))-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(199[0-9]|20[0-9][0-9])|`([0-2][0-9]|(3[01]))-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(199[0-9]|20[0-9][0-9]) <https://((discuss\.python\.org/t/([\w\-]+/)?\d+(?:/\d+/|/?))|(mail\.python\.org/pipermail/[\w\-]+/\d{4}-[A-Za-z]+/[A-Za-z0-9]+\.html)|(mail\.python\.org/archives/list/[\w\-]+@python\.org/thread/[A-Za-z0-9]+/?(#[A-Za-z0-9]+)?))>`__)(,|(?=\n[^ ])))+\n(?=[A-Z\n]))))'
210
- args : [--multiline]
211
- files : ' ^peps/pep-\d+\.rst$'
212
-
213
- - id : validate-resolution
214
- name : " 'Resolution' must be a direct thread/message URL or '`DD-mmm-YYYY <URL>`__'"
215
- language : pygrep
216
- entry : ' (?<!\n\n)(?<=\n)Resolution: (?:(?!https://((discuss\.python\.org/t/([\w\-]+/)?\d+(/\d+)?/?)|(mail\.python\.org/pipermail/[\w\-]+/\d{4}-[A-Za-z]+/[A-Za-z0-9]+\.html)|(mail\.python\.org/archives/list/[\w\-]+@python\.org/(message|thread)/[A-Za-z0-9]+/?(#[A-Za-z0-9]+)?)))|`([0-2][0-9]|(3[01]))-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(199[0-9]|20[0-9][0-9]) <(?:(?!https://((discuss\.python\.org/t/([\w\-]+/)?\d+(/\d+)?/?)|(mail\.python\.org/pipermail/[\w\-]+/\d{4}-[A-Za-z]+/[A-Za-z0-9]+\.html)|(mail\.python\.org/archives/list/[\w\-]+@python\.org/(message|thread)/[A-Za-z0-9]+/?(#[A-Za-z0-9]+)?)))>`__))\n'
217
- args : ['--multiline']
218
- files : ' ^peps/pep-\d+\.rst$'
219
-
220
- - id : check-direct-pep-links
221
- name : " Check that PEPs aren't linked directly"
222
- language : pygrep
223
- entry : ' (dev/peps|peps\.python\.org)/pep-\d+'
224
- files : ' ^peps/pep-\d+\.rst$'
225
- exclude : ' ^peps/pep-(0009|0287|0676|0684|8001)\.rst$'
226
-
227
- - id : check-direct-rfc-links
228
- name : " Check that RFCs aren't linked directly"
229
- language : pygrep
230
- entry : ' (rfc-editor\.org|ietf\.org)/[\.\-_\?\&\#\w/]*[Rr][Ff][Cc][\-_]?\d+'
231
- types : ['rst']
101
+ # Hook to run "check-peps.py"
102
+ - id : " check-peps"
103
+ name : " Check PEPs for metadata and content enforcement"
104
+ entry : " python check-peps.py"
105
+ language : " python"
106
+ files : ' ^peps/pep-\d{4}\.rst$'
107
+ require_serial : true
0 commit comments