Lint: Validate PEP fields against PEP 12 (#1890)

This commit is contained in:
CAM Gerlach 2021-03-23 09:55:26 -05:00 committed by GitHub
parent e183c197e6
commit d548fdfb61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 64 additions and 27 deletions

View File

@ -19,16 +19,60 @@ 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-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-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-type
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-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
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]
- 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]
- id: validate-resolution
name: "Validate PEP Resolution field"
language: pygrep
entry: '(?<!\n\n)^Resolution: (?:(?!https:\/\/\S*\n))'
args: ['--multiline']
files: '^pep-\d+\.(rst|txt)$'
types: [text]

View File

@ -7,7 +7,6 @@ Status: Deferred
Type: Standards Track
Content-Type: text/x-rst
Created: 02-May-2003
Python-Version:
Post-History:

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -7,7 +7,6 @@ Status: Withdrawn
Type: Standards Track
Content-Type: text/x-rst
Created: 21-Mar-2009
Python-Version: N.A.
Post-History:

View File

@ -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

View File

@ -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

View File

@ -9,7 +9,6 @@ Content-Type: text/x-rst
Created: 13-Oct-2011
Python-Version: 3.4
Post-History: 2011-10-13
Resolution: TBD
Abstract

View File

@ -10,7 +10,6 @@ Type: Process
Content-Type: text/x-rst
Created: 12-Jan-2012
Post-History: 17-Jan-2012
Resolution: TBD
Abstract

View File

@ -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

View File

@ -8,7 +8,6 @@ Type: Process
Content-Type: text/x-rst
Created: 24-Feb-2012
Post-History: 2012-02-24, 2012-02-25
Resolution: TBD
PEP Withdrawal

View File

@ -9,7 +9,7 @@ Type: Informational
Content-Type: text/x-rst
Created: 08-Jan-2015
Post-History:
Resolution:
Abstract
========

View File

@ -9,7 +9,7 @@ Type: Informational
Content-Type: text/x-rst
Created: 19-Dec-2014
Post-History:
Resolution:
Abstract
========

View File

@ -10,7 +10,7 @@ Type: Process
Content-Type: text/x-rst
Created: 12-Jan-2017
Post-History:
Resolution: https://mail.python.org/pipermail/distutils-sig/2018-March/032089.html
Resolution: https://mail.python.org/pipermail/distutils-sig/2018-March/032089.html
Abstract

View File

@ -1,4 +1,4 @@
PEP: 0617
PEP: 617
Title: New PEG parser for CPython
Version: $Revision$
Last-Modified: $Date$

View File

@ -17,7 +17,6 @@ Created: 23-Jun-2020
Python-Version: 3.10
Post-History: 23-Jun-2020, 8-Jul-2020
Superseded-By: 634
Resolution:
Abstract

View File

@ -9,7 +9,7 @@ Content-Type: text/x-rst
Created: 28-Jun-2011
Python-Version: 3.6
Post-History: 28-Jun-2011
Resolution: http://bugs.python.org/issue12345
Resolution: https://bugs.python.org/issue12345
Abstract

View File

@ -1,4 +1,4 @@
PEP: 0648
PEP: 648
Title: Extensible customizations of the interpreter at startup
Author: Mario Corchero <mariocj89@gmail.com>
Sponsor: Pablo Galindo

View File

@ -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

View File

@ -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

View File

@ -9,7 +9,6 @@ Content-Type: text/x-rst
Created: 09-Jul-2010
Python-Version: 3.4
Post-History: 2010-07-14, 2011-04-21, 2011-06-13
Resolution: TBD
Abstract