Skip to content
Latchkey

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.

pre-commit
black................................................(no files to check)Skipped
isort................................................(no files to check)Skipped

Common 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

  1. Add --all-files so every tracked file is checked.
  2. Add --show-diff-on-failure so required fixes are visible.
  3. Confirm hooks now run instead of skipping.
.github/workflows/ci.yml
- run: pre-commit run --all-files --show-diff-on-failure

Scope to a diff on large repos

For big repos, run only files changed against the base branch instead of the entire tree.

Terminal
pre-commit run --from-ref origin/main --to-ref HEAD

How 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-failure so failures are actionable.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →