2022-01-31 21:49:58 -05:00
|
|
|
# See https://pre-commit.com for more information
|
|
|
|
# See https://pre-commit.com/hooks.html for more hooks
|
|
|
|
|
|
|
|
minimum_pre_commit_version: '2.8.2'
|
|
|
|
|
|
|
|
default_language_version:
|
|
|
|
python: python3
|
|
|
|
|
|
|
|
default_stages: [commit]
|
|
|
|
|
|
|
|
|
2021-02-08 10:20:51 -05:00
|
|
|
repos:
|
2022-01-31 21:49:58 -05:00
|
|
|
# General file checks and fixers
|
2021-03-22 15:29:08 -04:00
|
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
2022-01-31 21:49:58 -05:00
|
|
|
rev: v4.1.0
|
2021-03-22 15:29:08 -04:00
|
|
|
hooks:
|
2022-01-24 18:40:15 -05:00
|
|
|
- id: mixed-line-ending
|
2022-01-31 21:49:58 -05:00
|
|
|
name: "Normalize mixed line endings"
|
2022-01-24 18:40:15 -05:00
|
|
|
args: [--fix=lf]
|
2022-01-31 21:49:58 -05:00
|
|
|
- id: fix-byte-order-marker
|
|
|
|
name: "Remove Unicode BOM"
|
|
|
|
- id: file-contents-sorter
|
|
|
|
name: "Sort codespell ignore list"
|
|
|
|
files: '.codespell/ignore-words.txt'
|
|
|
|
|
|
|
|
- id: check-case-conflict
|
|
|
|
name: "Check for case conflicts"
|
|
|
|
- id: check-merge-conflict
|
|
|
|
name: "Check for merge conflict markers"
|
|
|
|
- id: check-executables-have-shebangs
|
|
|
|
name: "Check that executables have shebangs"
|
|
|
|
- id: check-shebang-scripts-are-executable
|
|
|
|
name: "Check that shebangs are executable"
|
|
|
|
|
|
|
|
- id: check-vcs-permalinks
|
|
|
|
name: "Check that VCS links are permalinks"
|
|
|
|
|
|
|
|
- id: check-ast
|
|
|
|
name: "Check Python AST"
|
|
|
|
- id: check-json
|
|
|
|
name: "Check JSON"
|
|
|
|
- id: check-toml
|
|
|
|
name: "Check TOML"
|
|
|
|
- id: check-yaml
|
|
|
|
name: "Check YAML"
|
2021-03-22 15:29:08 -04:00
|
|
|
|
2022-01-31 21:49:58 -05:00
|
|
|
# RST checks
|
2021-02-08 10:20:51 -05:00
|
|
|
- repo: https://github.com/pre-commit/pygrep-hooks
|
2022-01-31 21:49:58 -05:00
|
|
|
rev: v1.9.0
|
2021-02-08 10:20:51 -05:00
|
|
|
hooks:
|
|
|
|
- id: rst-backticks
|
2022-01-31 21:49:58 -05:00
|
|
|
name: "Check RST: No single backticks"
|
2021-02-08 10:20:51 -05:00
|
|
|
- id: rst-inline-touching-normal
|
2022-01-31 21:49:58 -05:00
|
|
|
name: "Check RST: No backticks touching text"
|
2021-03-22 15:29:08 -04:00
|
|
|
files: '^pep-\d+\.txt|\.rst$'
|
|
|
|
types: [text]
|
|
|
|
- id: rst-directive-colons
|
2022-01-31 21:49:58 -05:00
|
|
|
name: "Check RST: 2 colons after directives"
|
2021-03-22 15:29:08 -04:00
|
|
|
files: '^pep-\d+\.txt|\.rst$'
|
|
|
|
types: [text]
|
|
|
|
|
2022-01-31 21:49:58 -05:00
|
|
|
# Manual codespell check
|
2022-01-24 18:40:15 -05:00
|
|
|
- repo: https://github.com/codespell-project/codespell
|
|
|
|
rev: v2.1.0
|
|
|
|
hooks:
|
|
|
|
- id: codespell
|
2022-01-31 21:49:58 -05:00
|
|
|
name: "Check for common misspellings in text files"
|
2022-01-24 18:40:15 -05:00
|
|
|
stages: [manual]
|
|
|
|
|
2022-01-31 21:49:58 -05:00
|
|
|
# Local checks for PEP headers and more
|
2021-03-22 15:29:08 -04:00
|
|
|
- repo: local
|
|
|
|
hooks:
|
2022-03-05 13:46:59 -05:00
|
|
|
- id: check-no-tabs
|
|
|
|
name: "Check tabs not used in PEPs"
|
|
|
|
language: pygrep
|
|
|
|
entry: '\t'
|
|
|
|
files: '^pep-\d+\.(rst|txt)$'
|
|
|
|
types: [text]
|
2021-03-23 10:55:26 -04:00
|
|
|
- id: check-required-fields
|
2022-01-31 21:49:58 -05:00
|
|
|
name: "Check PEPs have all required fields"
|
2021-03-22 15:29:08 -04:00
|
|
|
language: pygrep
|
2021-03-23 10:55:26 -04:00
|
|
|
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
|
2022-01-31 21:49:58 -05:00
|
|
|
name: "Validate PEP 'Status' field"
|
2021-03-23 10:55:26 -04:00
|
|
|
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
|
2022-01-31 21:49:58 -05:00
|
|
|
name: "Validate PEP 'Type' field"
|
2021-03-23 10:55:26 -04:00
|
|
|
language: pygrep
|
|
|
|
entry: '^Type:(?:(?! +(Standards Track|Informational|Process)$))'
|
|
|
|
files: '^pep-\d+\.(rst|txt)$'
|
|
|
|
types: [text]
|
|
|
|
- id: validate-content-type
|
2022-01-31 21:49:58 -05:00
|
|
|
name: "Validate PEP 'Content-Type' field"
|
2021-03-23 10:55:26 -04:00
|
|
|
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}),?)+$))'
|
2021-03-22 15:29:08 -04:00
|
|
|
files: '^pep-\d+\.(rst|txt)$'
|
|
|
|
types: [text]
|
|
|
|
- id: validate-created
|
2022-01-31 21:49:58 -05:00
|
|
|
name: "Validate PEP 'Created' field"
|
2021-03-22 15:29:08 -04:00
|
|
|
language: pygrep
|
2021-03-23 10:55:26 -04:00
|
|
|
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
|
2022-01-31 21:49:58 -05:00
|
|
|
name: "Validate PEP 'Python-Version' field"
|
2021-03-23 10:55:26 -04:00
|
|
|
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
|
2022-01-31 21:49:58 -05:00
|
|
|
name: "Validate PEP 'Resolution' field"
|
2021-03-23 10:55:26 -04:00
|
|
|
language: pygrep
|
2022-01-20 19:46:25 -05:00
|
|
|
entry: '(?<!\n\n)^Resolution: (?:(?!(https:\/\/\S*|:pep:`[a-zA-Z\d \-<>#]*?`)\n))'
|
2021-03-23 10:55:26 -04:00
|
|
|
args: ['--multiline']
|
2021-03-22 15:29:08 -04:00
|
|
|
files: '^pep-\d+\.(rst|txt)$'
|
|
|
|
types: [text]
|
2022-02-02 22:52:40 -05:00
|
|
|
- id: check-direct-pep-links
|
|
|
|
name: "Check that PEPs aren't linked directly"
|
|
|
|
language: pygrep
|
|
|
|
entry: 'dev/peps/pep-\d+'
|
|
|
|
files: '^pep-\d+\.(rst|txt)$'
|
|
|
|
exclude: '^pep-(0009|0287|8001)\.(rst|txt)$'
|
|
|
|
types: [text]
|
|
|
|
- id: check-direct-rfc-links
|
|
|
|
name: "Check that RFCs aren't linked directly"
|
|
|
|
language: pygrep
|
|
|
|
entry: '(rfc-editor\.org|ietf\.org)/[\.\-_\?\&\#\w/]*[Rr][Ff][Cc][\-_]?\d+'
|
|
|
|
files: '\.(rst|txt)$'
|
|
|
|
types: [text]
|