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.
== [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
- Run
sqlfluff fixlocally to auto-correct fixable rules. - Commit the formatted SQL.
- Keep
sqlfluff lintin CI as the gate.
sqlfluff fix models/ --dialect ansi
sqlfluff lint models/ --dialect ansiTune the rule set
Disable or configure rules you do not want in .sqlfluff rather than ignoring failures wholesale.
[sqlfluff]
dialect = postgres
[sqlfluff:rules:capitalisation.keywords]
capitalisation_policy = upperHow to prevent it
- Run
sqlfluff fixbefore committing so lint stays green. - Pin the rule set and dialect in
.sqlfluff. - Add a pre-commit hook so lint runs before CI.