Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transformers - Add sqlfluff workflow #93

Merged
merged 6 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/
Loading