pre-commit only checks changed files in CI (missing --all-files)
By default pre-commit run operates on staged changes. In CI you usually check out a commit with nothing staged, so pre-commit reports every hook as "(no files to check) Skipped" and the gate passes without checking anything.
What this error means
Every hook prints "(no files to check) Skipped" and the job passes green, even though the code has lint issues. Nothing was actually linted.
black................................................(no files to check)Skipped
isort................................................(no files to check)SkippedCommon causes
No files are staged in the CI checkout
A plain checkout leaves the working tree clean, so pre-commit run has no staged diff to operate on and skips all hooks.
Relying on the default changed-files behaviour
The step called pre-commit run without --all-files, so it only ever targets staged changes that do not exist in CI.
How to fix it
Run against all files in CI
- Add
--all-filesso every tracked file is checked. - Add
--show-diff-on-failureso required fixes are visible. - Confirm hooks now run instead of skipping.
- run: pre-commit run --all-files --show-diff-on-failureScope to a diff on large repos
For big repos, run only files changed against the base branch instead of the entire tree.
pre-commit run --from-ref origin/main --to-ref HEADHow to prevent it
- Always pass
--all-files(or an explicit diff range) in CI. - Treat "Skipped" across all hooks as a red flag, not a pass.
- Add
--show-diff-on-failureso failures are actionable.