Skip to content

Commit

Permalink
Add sqlfluff workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-snx committed Aug 7, 2024
1 parent 3b37679 commit 8bfdd85
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/sql_linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lint Transformer Models

on:
push:
branches:
- main
- 'transformers/**'

jobs:
lint-models:
runs-on: ubuntu-latest
steps:
- uses: "actions/checkout@v3"
- uses: "actions/setup-python@v3"
with:
python-version: "3.10.0"
- name: Install SQLFluff
run: "pip install sqlfluff"
- name: Lint models
run: "diff-quality --violations=sqlfluff --fail-under 100"
37 changes: 37 additions & 0 deletions transformers/synthetix/.sqlfluff
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[sqlfluff]
dialect = postgres
templater = jinja
runaway_limit = 10
max_line_length = 80
indent_unit = space

[sqlfluff:indentation]
tab_space_size = 4

[sqlfluff:layout:type:comma]
spacing_before = touch
line_position = trailing

[sqlfluff:rules:capitalisation.keywords]
capitalisation_policy = lower

[sqlfluff:rules:aliasing.table]
aliasing = explicit

[sqlfluff:rules:aliasing.column]
aliasing = explicit

[sqlfluff:rules:aliasing.expression]
allow_scalar = False

[sqlfluff:rules:capitalisation.identifiers]
extended_capitalisation_policy = lower

[sqlfluff:rules:capitalisation.functions]
capitalisation_policy = lower

[sqlfluff:rules:capitalisation.literals]
capitalisation_policy = lower

[sqlfluff:rules:ambiguous.column_references] # Number in group by
group_by_and_order_by_style = implicit
4 changes: 4 additions & 0 deletions transformers/synthetix/.sqlfluffignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target/
dbt_modules/
macros/
templates/

0 comments on commit 8bfdd85

Please sign in to comment.