sql/sqlfluff
Lints every SQL file for layout, capitalization, aliasing, and ambiguous references, in the dialect the database configuration names.
Part of the sql configuration, at the recommended level. It runs at the commit stage, per file. It runs sqlfluff. gspot check --fix fixes what it can.
When every SQL file follows one style, a reviewer can focus on what each statement does.
What to do
Section titled “What to do”Run gspot check --fix. Turn one rule off with gspot ignore sql/sqlfluff --rule <code> --reason "<why>".
Example
Section titled “Example”The query select id from user_accounts; reports CP01 for lowercase keywords. Write it as SELECT id FROM user_accounts;.
Turn it off
Section titled “Turn it off”Turn it off for some files, or one of its lint rules, with a reason:
gspot ignore sql/sqlfluff --paths "<glob>" --reason "<why>"gspot ignore sql/sqlfluff --rule <rule> --reason "<why>"To silence one place, write a comment such as:
SELECT * FROM orders -- noqa: AM04 -- the view mirrors every column