Skip to content

Commit

Permalink
WIP Lint SQL with SQLFluff
Browse files Browse the repository at this point in the history
One of the great advantages to using tinypg and postgres-migrations is
the ability to separate our SQL queries and migrations into SQL files.
We've already been benefiting from the editor support that approach
gains us!

Another benefit is the ability to use static analysis to improve our SQL
coding practices. Start using SQLFluff[1], a SQL linter that works with
PostgreSQL-flavored SQL.

WIP because it still needs:
- dev docs
- CI
- configuration
- to fix existing violations
- to ignore violations in existing migrations, since those can't be
  changed
- team consent

[1] https://docs.sqlfluff.com/en/stable/index.html
  • Loading branch information
jasonaowen committed May 1, 2023
1 parent 597bc17 commit 1068629
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .sqlfluff
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[sqlfluff]
dialect = postgres
templater = placeholder

[sqlfluff:indentation]
indent_unit = space
tab_space_size = 2

[sqlfluff:templater:placeholder]
param_style = colon

# placeholder values
externalId = '12-3456789'
limit = 20
offset = 0
search = ''

0 comments on commit 1068629

Please sign in to comment.