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

sqlfluff:layout:type:comma rule doesn't work for commas inside of procedures [redshift] #5870

Open
3 tasks done
MJedr opened this issue May 13, 2024 · 0 comments
Open
3 tasks done
Labels
bug Something isn't working redshift Issues relating to Amazon Redshift dialect

Comments

@MJedr
Copy link

MJedr commented May 13, 2024

Search before asking

  • I searched the issues and found no similar issues.

What Happened

We have .sqlfluff config defining comma position as trailing with sqlfluff:layout:type:comma. However, commas formatting is not applied to commas that are inside of procedure body.

Expected Behaviour

We would like to apply same comma formatting to all the commas in our code.

Observed Behaviour

Commas inside of procedure body stay. It happens for all the procedures after BEGIN statement. For example, we format the file

CREATE OR REPLACE PROCEDURE test(
 test INT,   -- here the formatting is correctly applied
 test2  VARCHAR
)

but later we have

BEGIN

    RAISE NOTICE '% started', l_proc_name;

    RAISE NOTICE '% test >= %'
        , test. -- here it's wrong
        , test;

How to reproduce

We tried to fix formatting with sqlfluff fix command.

Dialect

redshift

Version

sqlfluff, version 3.0.5

Configuration

[sqlfluff]
verbose = 0
dialect = redshift
templater = raw
exclude_rules = CV01,CV05,CV07,ST01,ST02,ST03,ST08
ignore = templating
large_file_skip_byte_limit = 0
max_line_length = 120

[sqlfluff:layout:type:alias_expression]
spacing_before = align
align_within = select_clause
spacing_after = touch

[sqlfluff:indentation]
tab_space_size = 2
indent_unit = space
indented_joins = false
indented_using_on = true
allow_implicit_indents = true
indented_on_contents = false
indented_ctes = false

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

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

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

[sqlfluff:rules:ambiguous.join]
fully_qualify_join_types = inner

[sqlfluff:rules:ambiguous.column_references]
group_by_and_order_by_style = consistent

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

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

[sqlfluff:rules:capitalisation.functions]
extended_capitalisation_policy = upper

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

[sqlfluff:rules:capitalisation.types]
extended_capitalisation_policy = upper

[sqlfluff:rules:jinja.padding]
single_space = true

[sqlfluff:rules:layout.spacing]
no_trailing_whitespace = true
extra_whitespace = false

[sqlfluff:rules:layout.functions]
no_space_after_function_name = true

[sqlfluff:rules:layout.select_targets]
wildcard_policy = single

[sqlfluff:rules:layout.set_operators]
set_operator_on_new_line = ['UNION', 'UNION ALL']

[sqlfluff:rules:structure.nested_case]

[sqlfluff:rules:structure.subquery]
forbid_subquery_in = join

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

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

[sqlfluff:convention.select_trailing_comma]
select_clause_trailing_comma = require

Are you willing to work on and submit a PR to address the issue?

  • Yes I am willing to submit a PR!

Code of Conduct

@MJedr MJedr added the bug Something isn't working label May 13, 2024
@github-actions github-actions bot added the redshift Issues relating to Amazon Redshift dialect label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working redshift Issues relating to Amazon Redshift dialect
Projects
None yet
Development

No branches or pull requests

1 participant