Setting up Pre-commit Hooks
What pre-commit does
Section titled “What pre-commit does”pre-commit runs checks before a commit is created.
This helps:
- keep formatting consistent
- avoid committing broken code
Example .pre-commit-config.yaml
Section titled “Example .pre-commit-config.yaml”repos:
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8Install and run
Section titled “Install and run”pre-commit install
pre-commit run --all-filesStill keep CI checks—hooks are helpful but not a replacement.
pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading