Verification · Hygiene · Formatting
Check mode gate
Run the formatter with --check or --diff in CI so unformatted code fails instead of being rewritten.
How to build it
- Add a CI job that runs the formatter in check mode, such as --check or --diff.
- Make the job fail on any drift and print the diff in the log.
- Run the same command in the pre-commit hook so contributors see the failure first.
Signals in a repository
- A CI step running ruff format --check, prettier --check, biome format --check or cargo fmt -- --check.
- A workflow job that exits non-zero on unformatted files.
- A pre-commit hook configured with the same formatter arguments as CI.
In practice
162 repositories run a tool for this check in the scanned set.
ruff-format· 43 reposblack· 14 reposprettier· 98 reposbiome· 24 reposrustfmt· 46 reposgofmt· 7 repos
Examples
-
freeCodeCamp/freeCodeCamp ·
prettierprettier --write client/i18n/locales/**/*.json -
kamranahmedse/developer-roadmap ·
prettierprettier --write . -
nousresearch/hermes-agent ·
prettierprettier --write src/**/*.{ts,tsx} packages/**/*.{ts,tsx} -
TheAlgorithms/Python ·
ruff-formatpre-commit hook ruff-format -
microsoft/vscode ·
rustfmtcargo fmt --check