diff --git a/.github/workflows/sql_linting.yml b/.github/workflows/sql_linting.yml new file mode 100644 index 00000000..1d4156b1 --- /dev/null +++ b/.github/workflows/sql_linting.yml @@ -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" diff --git a/transformers/synthetix/.sqlfluff b/transformers/synthetix/.sqlfluff new file mode 100644 index 00000000..8b1c4c38 --- /dev/null +++ b/transformers/synthetix/.sqlfluff @@ -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 diff --git a/transformers/synthetix/.sqlfluffignore b/transformers/synthetix/.sqlfluffignore new file mode 100644 index 00000000..32713bc1 --- /dev/null +++ b/transformers/synthetix/.sqlfluffignore @@ -0,0 +1,4 @@ +target/ +dbt_modules/ +macros/ +templates/