Pre-commit Hook Framework¶
Status: 🟢 Active | Owner: Engineering Enablement
Overview¶
pre-commit is required on all repositories. It runs automated checks on every commit, catching issues before they reach CI.
Installation¶
pip install pre-commit --user
# or
brew install pre-commit
# Install hooks in a repo
pre-commit install
pre-commit install --hook-type commit-msg
Standard .pre-commit-config.yaml¶
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-toml
- id: check-merge-conflict
- id: check-added-large-files
args: ['--maxkb=1000']
- id: detect-private-key
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.2
hooks:
- id: gitleaks
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.2.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
# Add language-specific hooks per your stack:
# Python
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
# TypeScript
- repo: local
hooks:
- id: eslint
name: eslint
entry: npx eslint --fix
language: node
types: [javascript, ts]
Last reviewed: 2025-Q4 | Owner: Engineering Enablement