Skip to content

Commit

Permalink
Lint: Add check-peps.py (#3275)
Browse files Browse the repository at this point in the history
``check-peps`` codifies the rules in PEP 1 and PEP 12 into a single
place containing all of the PEP-specific checks. These are primarily
header and metadata validation, and ensuring that direct links to
RFCs and PEPs aren't used.

Reviewed-by: Hugo van Kemenade <[email protected]>
Reviewed-by: C.A.M. Gerlach <[email protected]>
  • Loading branch information
AA-Turner authored Sep 5, 2023
1 parent fe3993d commit 814ceed
Show file tree
Hide file tree
Showing 16 changed files with 1,916 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ contents.rst @AA-Turner
.codespell/ @CAM-Gerlach @hugovk
.codespellrc @CAM-Gerlach @hugovk
.pre-commit-config.yaml @CAM-Gerlach @hugovk
check-peps.py @AA-Turner @CAM-Gerlach @hugovk

# Git infrastructure
.gitattributes @CAM-Gerlach
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,17 @@ jobs:
uses: pre-commit/[email protected]
with:
extra_args: --all-files --hook-stage manual codespell || true

check-peps:
name: Run check-peps
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: "3"

- name: Run check-peps
run: python check-peps.py --detailed
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ repos:
# Local checks for PEP headers and more
- repo: local
hooks:
# # Hook to run "check-peps.py"
# - id: "check-peps"
# name: "Check PEPs for metadata and content enforcement"
# entry: "python check-peps.py"
# language: "system"
# files: "^pep-\d{4}\.(rst|txt)$"
# require_serial: true

- id: check-no-tabs
name: "Check tabs not used in PEPs"
language: pygrep
Expand Down
Loading

0 comments on commit 814ceed

Please sign in to comment.