Skip to main content
Running Charter in a pre-commit hook catches score regressions before they reach CI and before other team members have to deal with them. With --quiet, the hook is completely silent on a passing commit and only interrupts when there’s something to fix.

Exit code behavior

All hook runners respect non-zero exit codes to block commits. No additional configuration is needed.
--quiet mode is essential for hooks. On pass: completely silent. On fail: one summary line with the failing findings. Without --quiet, every commit prints the full scan output — which gets noisy fast.

Setup

Threshold guidance

Use the same threshold in your pre-commit hook as in CI. If they diverge, local commits can succeed but CI will fail — which creates friction and erodes trust in the hook.
Set an explicit threshold to match your CI gate:
Or defer to whatever charter.yaml says, so hook and CI always agree automatically:
If charter.yaml has no policy section, Charter uses the built-in default of 80.

Next steps

Run Charter in GitHub Actions

Enforce the same gate on every pull request.

Policy Profiles

Set one threshold for hook and CI so they always agree.

charter.yaml Reference

Configure policy at the repo root.

charter doctor

The scan command the hook runs.