From fafa0a87b5191b0d8cfbd2a842380929682fdc00 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Mon, 22 Mar 2021 17:28:17 -0500 Subject: [PATCH 1/8] Lint: Check that all fields required by PEP 12 are present --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 26b2ccd5af3..05df4b2a34a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,16 +19,16 @@ repos: - repo: local hooks: - - id: check-created-exists - name: "Check all PEPs have created date" + - id: check-required-fields + name: "Check all PEPs have required fields" language: pygrep - entry: '^Created:' - args: ['--negate'] + entry: '(?-m:^PEP:(?=[\s\S]*\nTitle:)(?=[\s\S]*\nAuthor:)(?=[\s\S]*\nStatus:)(?=[\s\S]*\nType:)(?=[\s\S]*\nContent-Type:)(?=[\s\S]*\nCreated:))' + args: ['--negate', '--multiline'] files: '^pep-\d+\.(rst|txt)$' types: [text] - id: validate-created name: "Validate created dates" language: pygrep - 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])( \(|$)))' + 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])( \([^()]+\))?$))' files: '^pep-\d+\.(rst|txt)$' types: [text] From 8c93bfa6f1ee17d3156f390b9b39a2a054064759 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Mon, 22 Mar 2021 17:32:17 -0500 Subject: [PATCH 2/8] Lint: Validate that the PEP number matches the format in PEP 12 --- .pre-commit-config.yaml | 7 +++++++ pep-0617.rst | 2 +- pep-0648.rst | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 05df4b2a34a..0a4e66baba8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,13 @@ repos: args: ['--negate', '--multiline'] files: '^pep-\d+\.(rst|txt)$' types: [text] + - id: validate-pep-number + name: "Validate PEP number field" + language: pygrep + entry: '(?-m:^PEP:(?:(?! +(0|[1-9][0-9]{0,3})\n)))' + args: ['--multiline'] + files: '^pep-\d+\.(rst|txt)$' + types: [text] - id: validate-created name: "Validate created dates" language: pygrep diff --git a/pep-0617.rst b/pep-0617.rst index 3edf936146e..2b9ec2f8434 100644 --- a/pep-0617.rst +++ b/pep-0617.rst @@ -1,4 +1,4 @@ -PEP: 0617 +PEP: 617 Title: New PEG parser for CPython Version: $Revision$ Last-Modified: $Date$ diff --git a/pep-0648.rst b/pep-0648.rst index 27167ed992b..5707b79beac 100644 --- a/pep-0648.rst +++ b/pep-0648.rst @@ -1,4 +1,4 @@ -PEP: 0648 +PEP: 648 Title: Extensible customizations of the interpreter at startup Author: Mario Corchero Sponsor: Pablo Galindo From ca790a0d19eb081173292466e5c4cbc177a66c46 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Mon, 22 Mar 2021 18:32:00 -0500 Subject: [PATCH 3/8] Lint: Check that the status field contains a valid status --- .pre-commit-config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0a4e66baba8..b242887bf85 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,6 +33,12 @@ repos: args: ['--multiline'] files: '^pep-\d+\.(rst|txt)$' types: [text] + - id: validate-status + name: "Validate PEP status field" + language: pygrep + entry: '^Status:(?:(?! +(Draft|Withdrawn|Rejected|Accepted|Final|Active|Provisional|Deferred|Superseded|April Fool!)$))' + files: '^pep-\d+\.(rst|txt)$' + types: [text] - id: validate-created name: "Validate created dates" language: pygrep From 7273b62140d604a34293b62a975b0e6aa6639488 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Mon, 22 Mar 2021 18:34:16 -0500 Subject: [PATCH 4/8] Lint: Check that the type field contains a valid type --- .pre-commit-config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b242887bf85..cc3c3271e1d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,6 +39,12 @@ repos: entry: '^Status:(?:(?! +(Draft|Withdrawn|Rejected|Accepted|Final|Active|Provisional|Deferred|Superseded|April Fool!)$))' files: '^pep-\d+\.(rst|txt)$' types: [text] + - id: validate-type + name: "Validate PEP type field" + language: pygrep + entry: '^Type:(?:(?! +(Standards Track|Informational|Process)$))' + files: '^pep-\d+\.(rst|txt)$' + types: [text] - id: validate-created name: "Validate created dates" language: pygrep From 5deb238dcc512ef1146c09e385e732678da25cbf Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Mon, 22 Mar 2021 18:39:41 -0500 Subject: [PATCH 5/8] Lint: Check that the Content-Type field contains the expected value --- .pre-commit-config.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cc3c3271e1d..1c769355711 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,17 +34,23 @@ repos: files: '^pep-\d+\.(rst|txt)$' types: [text] - id: validate-status - name: "Validate PEP status field" + name: "Validate PEP Status field" language: pygrep entry: '^Status:(?:(?! +(Draft|Withdrawn|Rejected|Accepted|Final|Active|Provisional|Deferred|Superseded|April Fool!)$))' files: '^pep-\d+\.(rst|txt)$' types: [text] - id: validate-type - name: "Validate PEP type field" + name: "Validate PEP Type field" language: pygrep entry: '^Type:(?:(?! +(Standards Track|Informational|Process)$))' files: '^pep-\d+\.(rst|txt)$' types: [text] + - id: validate-content-type + name: "Validate PEP Content-Type field" + language: pygrep + entry: '^Content-Type:(?:(?! +text\/x-rst$))' + files: '^pep-\d+\.(rst|txt)$' + types: [text] - id: validate-created name: "Validate created dates" language: pygrep From a3f96b4122246994f4ece858523e8069579221f2 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Mon, 22 Mar 2021 18:46:07 -0500 Subject: [PATCH 6/8] Lint: Check that the PEP references fields contain valid PEP numbers --- .pre-commit-config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1c769355711..d59257bf02f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -51,6 +51,12 @@ repos: entry: '^Content-Type:(?:(?! +text\/x-rst$))' files: '^pep-\d+\.(rst|txt)$' types: [text] + - id: validate-pep-references + name: "Validate PEP reference fields" + language: pygrep + entry: '^(Requires|Replaces|Superseded-By):(?:(?! +( ?(0|[1-9][0-9]{0,3}),?)+$))' + files: '^pep-\d+\.(rst|txt)$' + types: [text] - id: validate-created name: "Validate created dates" language: pygrep From d8ccf1e5d6c9e6c98f1f30ae08024c7b02740528 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Mon, 22 Mar 2021 20:07:28 -0500 Subject: [PATCH 7/8] Lint: Validate Python-Version field, conform PEPs and fix typos --- .pre-commit-config.yaml | 6 ++++++ pep-0316.txt | 1 - pep-0328.txt | 2 +- pep-0361.txt | 2 +- pep-0371.txt | 2 +- pep-0378.txt | 2 +- pep-0381.txt | 1 - pep-0389.txt | 2 +- pep-0390.txt | 2 +- pep-0412.txt | 2 +- pep-3118.txt | 2 +- pep-3128.txt | 2 +- 12 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d59257bf02f..48c9bcac23a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -63,3 +63,9 @@ repos: 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])( \([^()]+\))?$))' files: '^pep-\d+\.(rst|txt)$' types: [text] + - id: validate-python-version + name: "Validate PEP Python-Version field" + language: pygrep + entry: '^Python-Version:(?:(?! +( ?[1-9]\.([0-9][0-9]?|x)(\.[1-9][0-9]?)?\??,?)+( \([^()]+\))?$))' + files: '^pep-\d+\.(rst|txt)$' + types: [text] diff --git a/pep-0316.txt b/pep-0316.txt index 685e3e6a074..65d0aed8553 100644 --- a/pep-0316.txt +++ b/pep-0316.txt @@ -7,7 +7,6 @@ Status: Deferred Type: Standards Track Content-Type: text/x-rst Created: 02-May-2003 -Python-Version: Post-History: diff --git a/pep-0328.txt b/pep-0328.txt index c90d074c6c6..cc3378ef35c 100644 --- a/pep-0328.txt +++ b/pep-0328.txt @@ -7,7 +7,7 @@ Status: Final Type: Standards Track Content-Type: text/x-rst Created: 21-Dec-2003 -Python-Version: 2.4, 2,5, 2.6 +Python-Version: 2.4, 2.5, 2.6 Post-History: 8-Mar-2004 diff --git a/pep-0361.txt b/pep-0361.txt index a0ec32e13f7..f87782e35b1 100644 --- a/pep-0361.txt +++ b/pep-0361.txt @@ -7,7 +7,7 @@ Status: Final Type: Informational Content-Type: text/x-rst Created: 29-Jun-2006 -Python-Version: 2.6 and 3.0 +Python-Version: 2.6, 3.0 Post-History: 17-Mar-2008 diff --git a/pep-0371.txt b/pep-0371.txt index 54b858a9943..6b197cf4c03 100644 --- a/pep-0371.txt +++ b/pep-0371.txt @@ -8,7 +8,7 @@ Status: Final Type: Standards Track Content-Type: text/x-rst Created: 06-May-2008 -Python-Version: 2.6 / 3.0 +Python-Version: 2.6, 3.0 Post-History: diff --git a/pep-0378.txt b/pep-0378.txt index 01a6b76c83a..2eca3133544 100644 --- a/pep-0378.txt +++ b/pep-0378.txt @@ -7,7 +7,7 @@ Status: Final Type: Standards Track Content-Type: text/x-rst Created: 12-Mar-2009 -Python-Version: 2.7 and 3.1 +Python-Version: 2.7, 3.1 Post-History: 12-Mar-2009 diff --git a/pep-0381.txt b/pep-0381.txt index 76b5d5b1817..6af6e5c94ec 100644 --- a/pep-0381.txt +++ b/pep-0381.txt @@ -7,7 +7,6 @@ Status: Withdrawn Type: Standards Track Content-Type: text/x-rst Created: 21-Mar-2009 -Python-Version: N.A. Post-History: diff --git a/pep-0389.txt b/pep-0389.txt index ec7b53f3a0c..900feb84e08 100644 --- a/pep-0389.txt +++ b/pep-0389.txt @@ -7,7 +7,7 @@ Status: Final Type: Standards Track Content-Type: text/x-rst Created: 25-Sep-2009 -Python-Version: 2.7 and 3.2 +Python-Version: 2.7, 3.2 Post-History: 27-Sep-2009, 24-Oct-2009 diff --git a/pep-0390.txt b/pep-0390.txt index 524901f463d..92605fde1bc 100644 --- a/pep-0390.txt +++ b/pep-0390.txt @@ -9,7 +9,7 @@ Status: Rejected Type: Standards Track Content-Type: text/x-rst Created: 10-Oct-2009 -Python-Version: 2.7 and 3.2 +Python-Version: 2.7, 3.2 Post-History: Resolution: https://mail.python.org/pipermail/distutils-sig/2013-April/020597.html diff --git a/pep-0412.txt b/pep-0412.txt index 7e5560949fd..2e4f07afeeb 100644 --- a/pep-0412.txt +++ b/pep-0412.txt @@ -7,7 +7,7 @@ Status: Final Type: Standards Track Content-Type: text/x-rst Created: 08-Feb-2012 -Python-Version: 3.3 or 3.4 +Python-Version: 3.3 Post-History: 08-Feb-2012 diff --git a/pep-3118.txt b/pep-3118.txt index 74b56c4d0e5..b8d5f7cf749 100644 --- a/pep-3118.txt +++ b/pep-3118.txt @@ -7,7 +7,7 @@ Status: Final Type: Standards Track Content-Type: text/x-rst Created: 28-Aug-2006 -Python-Version: 3000 +Python-Version: 3.0 Post-History: Abstract diff --git a/pep-3128.txt b/pep-3128.txt index 7cddaf5ff16..c4c3e825446 100644 --- a/pep-3128.txt +++ b/pep-3128.txt @@ -8,7 +8,7 @@ Status: Rejected Type: Standards Track Content-Type: text/x-rst Created: 30-Apr-2007 -Python-Version: 2.6 and/or 3.0 +Python-Version: 2.6, 3.0 Post-History: 30-Apr-2007 From 95e2bd27c42ab67864c6a583dae7d9671fea5ced Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Mon, 22 Mar 2021 21:56:48 -0500 Subject: [PATCH 8/8] Lint: Check that the Resolution field, if non-empty, contains a URL --- .pre-commit-config.yaml | 7 +++++++ pep-0403.txt | 1 - pep-0407.txt | 1 - pep-0413.txt | 1 - pep-0482.txt | 2 +- pep-0483.txt | 2 +- pep-0541.txt | 2 +- pep-0622.rst | 1 - pep-0628.txt | 2 +- pep-3150.txt | 1 - 10 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 48c9bcac23a..d339a4fd449 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -69,3 +69,10 @@ repos: entry: '^Python-Version:(?:(?! +( ?[1-9]\.([0-9][0-9]?|x)(\.[1-9][0-9]?)?\??,?)+( \([^()]+\))?$))' files: '^pep-\d+\.(rst|txt)$' types: [text] + - id: validate-resolution + name: "Validate PEP Resolution field" + language: pygrep + entry: '(?