ruff format --check "would reformat" in CI
ruff format --check does not change files; it reports which ones differ from ruff's formatter output, prints how many "would be reformatted", and exits 1 if any do.
What this error means
The format check prints "Would reformat: path/to/file.py" lines, a summary like "1 file would be reformatted", and exits with code 1.
Would reformat: app/main.py
1 file would be reformatted, 12 files already formattedCommon causes
Files were not formatted with ruff
The listed files differ from ruff format output, so --check flags them and fails.
A ruff version change shifted formatting
A different ruff version formats slightly differently than the one used when the files were committed.
How to fix it
Format and commit
- Run
ruff formatto apply formatting. - Commit the changes.
- Re-run
ruff format --checkto confirm exit 0.
ruff format .
ruff format --check .Pin ruff across local and CI
Lock the ruff version so local format and CI --check agree.
# pyproject.toml
[tool.ruff]
required-version = "0.5.0"How to prevent it
- Run
ruff formatin a pre-commit hook. - Pin the ruff version in your project config.
- Keep formatter settings in one shared config.