ruff check exits 1 on lint violations in CI
ruff exits 1 when it reports any lint violation. The summary line "Found N errors." and the rule codes (like F401, E501) tell you exactly what to fix; many are auto-fixable.
What this error means
The lint step lists violations as file:line:col: CODE message, ends with "Found N errors." and a "[*] N fixable with the --fix option" hint, and exits 1.
app/main.py:1:8: F401 [*] `os` imported but unused
app/main.py:14:5: E731 Do not assign a lambda expression, use a def
Found 2 errors.
[*] 1 fixable with the `--fix` option.Common causes
Real rule violations in the selected rule set
ruff found problems under the rules you enabled (select), so it exits 1 and reports each with its code.
A wider rule set surfaced new findings
Enabling more rules or upgrading ruff (which ships new checks) can add violations that were not flagged before.
How to fix it
Auto-fix what you can, then fix the rest
- Run
ruff check --fixto apply the fixable findings. - Resolve the remaining violations by hand using the rule codes.
- Re-run
ruff checkand confirm it exits 0.
ruff check --fix .
ruff check . # confirm 0 errorsSilence a specific finding deliberately
Use a # noqa: CODE on a line or per-file-ignores in config rather than disabling ruff in CI.
# pyproject.toml
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]How to prevent it
- Run
ruff checklocally or in pre-commit before pushing. - Pin the ruff version so new rules do not appear unexpectedly.
- Adopt new rule sets in a dedicated change with the fixes.