python-peps/.pre-commit-config.yaml

108 lines
2.9 KiB
YAML

# 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: [pre-commit]
repos:
# General file checks and fixers
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: mixed-line-ending
name: "Normalize mixed line endings"
args: [--fix=lf]
- 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"
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.10.0
hooks:
- id: black
name: "Format with Black"
args:
- '--target-version=py39'
- '--target-version=py310'
files: '^(peps/conf\.py|pep_sphinx_extensions/tests/.*)$'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.0
hooks:
- id: ruff
name: "Lint with Ruff"
args:
- '--exit-non-zero-on-fix'
files: '^pep_sphinx_extensions/tests/'
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 1.4.1
hooks:
- id: tox-ini-fmt
name: "Format tox.ini"
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v1.0.0
hooks:
- id: sphinx-lint
name: "Sphinx lint"
args: ["--disable=trailing-whitespace"]
# RST checks
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks
name: "Check RST: No single backticks"
- id: rst-inline-touching-normal
name: "Check RST: No backticks touching text"
- id: rst-directive-colons
name: "Check RST: 2 colons after directives"
# Manual codespell check
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
name: "Check for common misspellings in text files"
stages: [manual]
# 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: "python"
files: '^peps/pep-\d{4}\.rst$'
require_serial: true