Skip to content

Commit 765bd41

Browse files
committed
Add checks for hardcoded direct links to PEPs and RFCs
1 parent 7069d80 commit 765bd41

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,16 @@ repos:
127127
args: ['--multiline']
128128
files: '^pep-\d+\.(rst|txt)$'
129129
types: [text]
130+
- id: check-direct-pep-links
131+
name: "Check that PEPs aren't linked directly"
132+
language: pygrep
133+
entry: 'dev/peps/pep-\d+'
134+
files: '^pep-\d+\.(rst|txt)$'
135+
exclude: '^pep-(0009|0287|8001)\.(rst|txt)$'
136+
types: [text]
137+
- id: check-direct-rfc-links
138+
name: "Check that RFCs aren't linked directly"
139+
language: pygrep
140+
entry: '(rfc-editor\.org|ietf\.org)/[\.\-_\?\&\#\w/]*[Rr][Ff][Cc][\-_]?\d+'
141+
files: '\.(rst|txt)$'
142+
types: [text]

pep-0340.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ accepted, these can be changed to just "yield" of course.)
461461
Used as follows::
462462

463463
block auto_retry(3, IOError):
464-
f = urllib.urlopen("http://www.python.org/dev/peps/pep-0340/")
464+
f = urllib.urlopen("https://www.example.com/")
465465
print f.read()
466466

467467
5. It is possible to nest blocks and combine templates::

pep-0427.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,9 @@ checker only needs to establish that RECORD matches the signature.
312312

313313
See
314314

315-
- https://datatracker.ietf.org/doc/html/rfc7515
315+
- :rfc:`7515`
316316
- https://datatracker.ietf.org/doc/html/draft-jones-jose-jws-json-serialization.html
317-
- https://datatracker.ietf.org/doc/html/rfc7517
317+
- :rfc:`7517`
318318
- https://datatracker.ietf.org/doc/html/draft-jones-jose-json-private-key.html
319319

320320

pep-0491.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,9 @@ checker only needs to establish that RECORD matches the signature.
394394

395395
See
396396

397-
- https://datatracker.ietf.org/doc/html/rfc7515
397+
- :rfc:`7515`
398398
- https://datatracker.ietf.org/doc/html/draft-jones-jose-jws-json-serialization.html
399-
- https://datatracker.ietf.org/doc/html/rfc7517
399+
- :rfc:`7517`
400400
- https://datatracker.ietf.org/doc/html/draft-jones-jose-json-private-key.html
401401

402402

0 commit comments

Comments
 (0)