Skip to content

Commit

Permalink
Merge pull request #93 from Synthetixio/transformers/add-sqlfluff
Browse files Browse the repository at this point in the history
Transformers - Add sqlfluff workflow
  • Loading branch information
Tburm authored Aug 9, 2024
2 parents 87fef05 + adb61a4 commit 546bc18
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/sql_linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Lint Transformer Models

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

jobs:
lint-models:
runs-on: ubuntu-latest
steps:
- uses: "actions/checkout@v4"
with:
fetch-depth: 0
- uses: "actions/setup-python@v3"
with:
python-version: "3.10.11"
- name: Install SQLFluff
run: "pip install sqlfluff"
- name: Lint models
run: "diff-quality --violations=sqlfluff --compare-branch origin/main --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 546bc18

Please sign in to comment.