Skip to content

Instantly share code, notes, and snippets.

@dave-connors-3
Created February 13, 2023 20:27
Show Gist options
  • Save dave-connors-3/94a4cdc46f7ec72c3afc3023aaa51d9d to your computer and use it in GitHub Desktop.
Save dave-connors-3/94a4cdc46f7ec72c3afc3023aaa51d9d to your computer and use it in GitHub Desktop.
dbt labs sqlfluff
[sqlfluff]
dialect = snowflake
templater = dbt
runaway_limit = 10
rules = L002, L004, L005, L010, L011, L012, L013, L014, L016, L018, L019, L022, L023, L027, L030, L031, L032, L033, L034, L040, L046, L048, L042, L051, L054, L065
max_line_length = 80
indent_unit = space
# Rule definitions:
# L002: Mixed Tabs and Spaces in single whitespace
# L004: Incorrect indentation type (should be space)
# L004: Commas should not have whitespace directly before them.
# L010: Inconsistent capitalisation of keywords (should be lowercase)
# L011: Implicit/explicit aliasing of table (use 'as' for alias)
# L012: Implicit/explicit aliasing of columns (use 'as' for alias)
# L013: Column expression without alias (use 'as' for alias)
# L014: Inconsistent capitalisation of unquoted identifiers (should be lowercase)
# L016: Line is too long
# L018: WITH clause closing bracket should be on a new line.
# L019: Trailing comma enforcement
# L022: Blank line expected but not found after CTE closing bracket.
# L023: Single whitespace expected after AS in WITH clause.
# L027: References should be qualified if select has more than one referenced table/view
# L030: Inconsistent capitalisation of function names (should be lowercase)
# L031: Avoid table aliases in from clauses and join conditions
# L032: Prefer specifying join keys instead of using USING.
# L033: UNION [DISTINCT|ALL] is preferred over just UNION
# L034: Select wildcards then simple targets before calculations and aggregates
# L040: Inconsistent capitalisation of boolean/null literal (should be lowercase)
# L042: Join/From clauses should not contain subqueries. Use CTEs instead.
# L046: Jinja tags should have a single whitespace on either side.
# L048: Quoted literals should be surrounded by a single whitespace.
# L051: Join clauses should be fully qualified (LEFT/RIGHT/FULL/INNER)
# L054: Use numbers in GROUP BY and ORDER BY
# L065: Set operators should be surrounded by newlines.
[sqlfluff:indentation]
tab_space_size = 4
[sqlfluff:layout:type:comma]
spacing_before = touch
line_position = trailing
#[sqlfluff:templater:jinja]
#load_macros_from_path = macros
[sqlfluff:rules:L010] # Keywords
capitalisation_policy = lower
[sqlfluff:rules:L011] # Explicit table alias
aliasing = explicit
[sqlfluff:rules:L012] # Explicit column alias
aliasing = explicit
[sqlfluff:rules:L013] # Column expressions must have alias
allow_scalar = False
[sqlfluff:rules:L014] # Unquoted identifiers
extended_capitalisation_policy = lower
[sqlfluff:rules:L030] # Function names
capitalisation_policy = lower
[sqlfluff:rules:L040] # Boolean names
capitalisation_policy = lower
[sqlfluff:rules:L054] # Number in group by
group_by_and_order_by_style = implicit
@bossnunta
Copy link

This is perfect for what we'll need -- it might be good to add comments to explain what they could/should change (e.g. line 2 on dialect, we may want to suggest other dialects)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment