Skip to content
Latchkey

sqlfluff lint rule failures (L010 and friends) in CI

sqlfluff linted your SQL and found rule violations (for example L010 keyword capitalization or LT01 spacing), so sqlfluff lint exits non-zero. The gate is working; the SQL needs formatting or a rule needs configuring.

What this error means

A sqlfluff lint step prints violations with rule codes and exits with code 1, failing the workflow, even though the SQL runs fine.

sqlfluff
== [models/orders.sql] FAIL
L:   3 | P:   1 | LT02 | Expected indent of 4 spaces.
L:   5 | P:  10 | L010 | Keywords must be consistently upper case.
All Finished! Found 2 violations.

Common causes

SQL that does not match the configured style

The code violates rules such as keyword case or indentation that your .sqlfluff config enforces.

Rules enabled that the team did not intend

The default rule set is stricter than your house style, so files fail on rules you would rather relax.

How to fix it

Auto-fix then lint

  1. Run sqlfluff fix locally to auto-correct fixable rules.
  2. Commit the formatted SQL.
  3. Keep sqlfluff lint in CI as the gate.
Terminal
sqlfluff fix models/ --dialect ansi
sqlfluff lint models/ --dialect ansi

Tune the rule set

Disable or configure rules you do not want in .sqlfluff rather than ignoring failures wholesale.

.sqlfluff
[sqlfluff]
dialect = postgres
[sqlfluff:rules:capitalisation.keywords]
capitalisation_policy = upper

How to prevent it

  • Run sqlfluff fix before committing so lint stays green.
  • Pin the rule set and dialect in .sqlfluff.
  • Add a pre-commit hook so lint runs before CI.

Frequently asked questions

What causes "sqlfluff "L010 ..." lint fail"?
The code violates rules such as keyword case or indentation that your .sqlfluff config enforces.
How do I fix sqlfluff "L010 ..." lint fail?
Auto-fix then lint

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card