-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Lint: Update headers and checks per current guidance & provide helpful feedback #2484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c826909
e03b73c
8df4c4d
2c98989
e75643e
7abaaf3
ad6ba56
dd30fff
309ec3c
b3fef66
eff7423
a829dff
90add11
3712bba
afd0a40
b51cde8
a894d22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,6 @@ repos: | |
- id: mixed-line-ending | ||
name: "Normalize mixed line endings" | ||
args: [--fix=lf] | ||
- id: fix-byte-order-marker | ||
name: "Remove Unicode BOM" | ||
- id: file-contents-sorter | ||
name: "Sort codespell ignore list" | ||
files: '.codespell/ignore-words.txt' | ||
|
@@ -35,8 +33,8 @@ repos: | |
- id: check-vcs-permalinks | ||
name: "Check that VCS links are permalinks" | ||
|
||
- id: check-ast | ||
name: "Check Python AST" | ||
# - id: check-ast | ||
# name: "Check Python AST" | ||
- id: check-json | ||
name: "Check JSON" | ||
- id: check-toml | ||
|
@@ -76,70 +74,136 @@ repos: | |
entry: '\t' | ||
files: '^pep-\d+\.(rst|txt)$' | ||
types: [text] | ||
|
||
- id: check-required-fields | ||
name: "Check PEPs have all required fields" | ||
name: "Check PEPs have all required headers" | ||
language: pygrep | ||
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" | ||
name: "'PEP' header must be a number 1-9999" | ||
language: pygrep | ||
entry: '(?-m:^PEP:(?:(?! +(0|[1-9][0-9]{0,3})\n)))' | ||
args: ['--multiline'] | ||
files: '^pep-\d+\.(rst|txt)$' | ||
types: [text] | ||
|
||
- id: validate-title | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yikes, 128 lines of regex hooks! "Now you have two problems" :) At least we need to worry about ReDoS attacks, it would only target the CI. Some of these are complex (longest is 475 chars) so I'm not going to review the individual regexes and don't really want to have to debug any of them :) I'm tempted to suggest a Python based checker instead, it could replace a lot of these with simpler string manipulation, and could replace some duplication in those that require regex. How about a flake8-pep plugin?? |
||
name: "'Title' must be 1-79 characters" | ||
language: pygrep | ||
entry: '(?<=\n)Title:(?:(?! +\S.{1,78}\n(?=[A-Z])))' | ||
args: ['--multiline'] | ||
files: '^pep-\d+\.(rst|txt)$' | ||
exclude: '^pep-(0499)\.(rst|txt)$' | ||
types: [text] | ||
|
||
- id: validate-author | ||
hugovk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
name: "'Author' must be list of 'Name <email@example.com>, ...'" | ||
language: pygrep | ||
entry: '(?<=\n)Author:(?:(?!((( +|\n {1,8})[^!#$%&()*+,/:;<=>?@\[\\\]\^_`{|}~]+( <[\w!#$%&''*+\-/=?^_{|}~.]+(@| at )[\w\-.]+\.[A-Za-z0-9]+>)?)(,|(?=\n[^ ])))+\n(?=[A-Z])))' | ||
args: [--multiline] | ||
files: '^pep-\d+\.rst$' | ||
types: [text] | ||
|
||
- id: validate-author-legacy | ||
name: "Legacy 'Author' must be a list of names/emails" | ||
language: pygrep | ||
entry: '(?<=\n)Author:(?:(?!((((( +|\n {1,8})[^!#$%&()*+,/:;<=>?@\[\\\]\^_`{|}~]+( <[\w!#$%&''*+\-/=?^_{|}~.]+(@| at )[\w\-.]+\.[A-Za-z0-9]+>)?)(,|(?=\n[^ ])))+)|(((( +|\n {1,8})[\w!#$%&''*+\-/=?^_{|}~.]+(@| at )[\w\-.]+\.[A-Za-z0-9]+) \(([^!#$%&()*+,/:;<=>?@\[\\\]\^_`{|}~]+)\)(,|(?=\n[^ ])))+))\n(?=[A-Z])))' | ||
args: [--multiline] | ||
files: '^pep-\d+\.(rst|txt)$' | ||
types: [text] | ||
|
||
- id: validate-sponsor | ||
name: "'Sponsor' must have format 'Name <email@example.com>'" | ||
language: pygrep | ||
entry: '^Sponsor:(?: (?! *[^!#$%&()*+,/:;<=>?@\[\\\]\^_`{|}~]+( <[\w!#$%&''*+\-/=?^_{|}~.]+(@| at )[\w\-.]+\.[A-Za-z0-9]+>)?$))' | ||
files: '^pep-\d+\.(rst|txt)$' | ||
types: [text] | ||
|
||
- id: validate-delegate | ||
name: "'Delegate' must have format 'Name <email@example.com>'" | ||
language: pygrep | ||
entry: '^(PEP|BDFL)-Delegate: (?:(?! *[^!#$%&()*+,/:;<=>?@\[\\\]\^_`{|}~]+( <[\w!#$%&''*+\-/=?^_{|}~.]+(@| at )[\w\-.]+\.[A-Za-z0-9]+>)?$))' | ||
files: '^pep-\d+\.(rst|txt)$' | ||
exclude: '^pep-(0451)\.(rst|txt)$' | ||
types: [text] | ||
|
||
- id: validate-discussions-to | ||
name: "'Discussions-To' must be a thread URL" | ||
language: pygrep | ||
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]+/?))$))' | ||
files: '^pep-\d+\.(rst|txt)$' | ||
types: [text] | ||
|
||
- id: validate-status | ||
name: "Validate PEP 'Status' field" | ||
name: "'Status' must be a valid PEP status" | ||
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: "'Type' must be a valid PEP type" | ||
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" | ||
name: "'Content-Type' must be 'text/x-rst'" | ||
language: pygrep | ||
entry: '^Content-Type:(?:(?! +text\/x-rst$))' | ||
entry: '^Content-Type:(?:(?! +text/x-rst$))' | ||
files: '^pep-\d+\.(rst|txt)$' | ||
types: [text] | ||
|
||
- id: validate-pep-references | ||
name: "Validate PEP reference fields" | ||
name: "`Requires`/`Replaces`/`Superseded-By` must be 'NNN' PEP IDs" | ||
language: pygrep | ||
entry: '^(Requires|Replaces|Superseded-By):(?:(?! +( ?(0|[1-9][0-9]{0,3}),?)+$))' | ||
entry: '^(Requires|Replaces|Superseded-By):(?:(?! *( (0|[1-9][0-9]{0,3})(,|$))+$))' | ||
files: '^pep-\d+\.(rst|txt)$' | ||
types: [text] | ||
|
||
- id: validate-created | ||
name: "Validate PEP 'Created' field" | ||
name: "'Created' must be a 'DD-mmm-YYYY' date" | ||
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" | ||
name: "'Python-Version' must be a 'X.Y[.Z]` version" | ||
language: pygrep | ||
entry: '^Python-Version:(?:(?! +( ?[1-9]\.([0-9][0-9]?|x)(\.[1-9][0-9]?)?\??,?)+( \([^()]+\))?$))' | ||
entry: '^Python-Version:(?:(?! *( [1-9]\.([0-9][0-9]?|x)(\.[1-9][0-9]?)?(,|$))+$))' | ||
files: '^pep-\d+\.(rst|txt)$' | ||
types: [text] | ||
|
||
- id: validate-post-history | ||
name: "'Post-History' must be '`DD-mmm-YYYY <Thread URL>`__, ...'" | ||
language: pygrep | ||
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+/?)|(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]))))' | ||
args: [--multiline] | ||
files: '^pep-\d+\.(rst|txt)$' | ||
types: [text] | ||
|
||
- id: validate-resolution | ||
name: "Validate PEP 'Resolution' field" | ||
name: "'Resolution' must be a direct thread/message URL" | ||
language: pygrep | ||
entry: '(?<!\n\n)^Resolution: (?:(?!(https:\/\/\S*|:pep:`[a-zA-Z\d \-<>#]*?`)\n))' | ||
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]+)?))\n(?=\n)))' | ||
args: ['--multiline'] | ||
files: '^pep-\d+\.(rst|txt)$' | ||
types: [text] | ||
|
||
- id: check-direct-pep-links | ||
name: "Check that PEPs aren't linked directly" | ||
language: pygrep | ||
entry: '(dev/peps|peps\.python\.org)/pep-\d+' | ||
files: '^pep-\d+\.(rst|txt)$' | ||
exclude: '^pep-(0009|0287|0676|8001)\.(rst|txt)$' | ||
types: [text] | ||
|
||
- id: check-direct-rfc-links | ||
name: "Check that RFCs aren't linked directly" | ||
language: pygrep | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ Title: Backwards Compatibility Policy | |
Version: $Revision$ | ||
Last-Modified: $Date$ | ||
Author: Benjamin Peterson <benjamin@python.org> | ||
BDFL-Delegate: Brett Cannon (on behalf of the steering council) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a desire in #1672 to enforce PEP-Delegate in new PEPs but keep BDFL-Delegate in old ones. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this PEP is still "Active" it seems reasonable to change it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I didn't mass-change it; in this case though this PEP is explicitly stated to be approved |
||
Discussions-To: https://discuss.python.org/t/pep-387-backwards-compatibilty-policy/ | ||
PEP-Delegate: Brett Cannon <brett@python.org> | ||
Discussions-To: https://discuss.python.org/t/pep-387-backwards-compatibilty-policy/4421 | ||
Status: Active | ||
Type: Process | ||
Content-Type: text/x-rst | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be removed or uncommented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I commented it as a stopgap fix for #2402 , but depending on what we ultimately decide there, there's a chance we may want to restore it. That said, I can remove it, if you think its important.