Skip to content
Latchkey

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.

ruff
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

  1. Run ruff check --fix to apply the fixable findings.
  2. Resolve the remaining violations by hand using the rule codes.
  3. Re-run ruff check and confirm it exits 0.
Terminal
ruff check --fix .
ruff check .   # confirm 0 errors

Silence 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
# pyproject.toml
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]

How to prevent it

  • Run ruff check locally 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.

Related guides

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