Collapse the per-language hook tables in pc-author's hooks-by-language.md into one shared-repo table plus an "other repos" table, dropping the repeated repo/rev/rationale text that just restated what each hook does. 128 -> 92 lines. Kept both "Unverified — not in research corpus" flags and the rev-freshness caveat. Remove the generic SSH/proxy CI failure sections, the shellcheck SC-code listing, and compress the generic validate-config schema-error bullets in pc-run's failure-patterns.md, all of which just restated pre-commit.com's own docs. 133 -> 109 lines. Kept the rtk-prefixed re-stage/recommit fix (ADR-0023), the "do NOT reach for `pre-commit install -f`" warning, and both gitleaks/shellcheck not-sourced-from-corpus notes. Combined cut: 60 lines. Flat mirrors regenerated via scripts/sync-plugin-content.sh and verified byte-identical (--check exits 0); no plugin.json drift. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YR2CjVumUbEGWcMikcoXBD
4.5 KiB
source_keys
| source_keys | ||||
|---|---|---|---|---|
|
Hook Recommendations by Language / Context
Use this table when creating a config from scratch or recommending hooks to add. Always check the existing config for duplicates before proposing.
Fixer hooks (trailing-whitespace, end-of-file-fixer, pretty-format-json and the like) rewrite
files but do NOT re-stage them, so the commit is still blocked and the user has to stage and commit
again. Say so when proposing one — otherwise the first blocked commit reads as the hook being
broken.
pre-commit/pre-commit-hooks (rev v6.0.0)
| Hook ID | Language / Context |
|---|---|
end-of-file-fixer |
Universal |
trailing-whitespace |
Universal |
check-merge-conflict |
Universal |
detect-private-key |
Universal |
check-added-large-files |
Universal |
check-case-conflict |
Universal |
mixed-line-ending |
Universal |
no-commit-to-branch |
Universal — defaults to blocking main+master with no args; add args: [--branch, <name>] only to protect additional branch names |
check-ast |
Python (.py) |
check-builtin-literals |
Python (.py) |
check-json |
JSON (.json) |
pretty-format-json |
JSON (.json) |
check-yaml |
YAML (.yaml, .yml) — for Kubernetes/Helm with custom tags add args: ['--unsafe'] and exclude: ^helm/templates/ |
check-toml |
TOML (.toml) |
Full repo URL: https://github.com/pre-commit/pre-commit-hooks. For Python formatting, check if black, ruff, or isort is already configured in pyproject.toml before recommending them.
Other repos
| Hook ID | Repo | Rev | Notes |
|---|---|---|---|
shellcheck |
https://github.com/jumanjihouse/pre-commit-hooks |
3.0.0 |
Unverified — not in research corpus, verify upstream before use. Recommended args: args: [--severity=warning] |
gitleaks |
https://github.com/gitleaks/gitleaks |
v8.30.1 |
Unverified — not in research corpus, verify upstream before use. |
conventional-pre-commit |
https://github.com/compilerla/conventional-pre-commit |
v2.4.0 |
Stage commit-msg; also add default_install_hook_types: [pre-commit, commit-msg] to the top-level config if not already present |
Meta-validation (add last, after all other repos)
- repo: meta
hooks:
- id: check-hooks-apply # catches hooks that match no files
- id: check-useless-excludes # catches exclude patterns that match no files
Local hooks (repo: local)
Use for repo-specific scripts that don't belong in an external hook repo.
- repo: local
hooks:
- id: run-tests
name: Run test suite
entry: bash tests/run-tests.sh
language: unsupported_script
pass_filenames: false
always_run: true
stages: [pre-push]
language: system and language: script are deprecated names for the first two below.
New local hooks use unsupported and unsupported_script.
Language choices for local hooks:
unsupported— system PATH tool (pre-commit does not manage env)unsupported_script— script at a repo-relative pathfail— always-fail guard;entrytext becomes the error messagepython— isolated venv; useadditional_dependenciesfor pip packagesnode— isolated node env;additional_dependenciesare npm packagesruby— isolated gem env;additional_dependenciesare gemsgolang— builds from source;additional_dependenciesare Go module pathsrust— Cargo builddocker— Docker image built fromentry; use when no other language fitsdocker_image— pulls a pre-built Docker image byentryconda— Conda environment; conda-native hookscoursier— Coursier (Scala/JVM) environment; JVM hooks
Rev pin freshness
The revs above were last verified current at time of writing (matched against the plugin's own research corpus in docs/research/docs/pre-commit/; rows marked "Unverified" have no such backing and must be checked against upstream before use). Since the "Rev staleness" check in references/modify-config.md treats these tables as ground truth, a pin that goes stale here produces false-positive staleness warnings for users who already have a newer, correct rev. Re-verify these pins periodically (e.g. against each repo's latest release tag). When in doubt, treat pre-commit autoupdate's own output as the authoritative staleness signal, not a mismatch against these tables.