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

Conflict between layout.cte_bracket and layout.indent #5893

Open
3 tasks done
max-ostapenko opened this issue May 20, 2024 · 0 comments
Open
3 tasks done

Conflict between layout.cte_bracket and layout.indent #5893

max-ostapenko opened this issue May 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@max-ostapenko
Copy link

Search before asking

  • I searched the issues and found no similar issues.

What Happened

CTE closing bracket is on the same line and layout.cte_bracket is excluded.
Linting still raises an error for layout.indent.

WITH zoo AS (
    SELECT a FROM foo)

SELECT * FROM zoo
$ sqlfluff lint qwe.sql
== [example.sql] FAIL                                                                                                         
L:   2 | P:  22 | LT02 | Expected line break and no indent before ')'.
                       | [layout.indent]
All Finished 📜 🎉!

and expects the following:

WITH zoo AS (
    SELECT a FROM foo
)

SELECT * FROM zoo

Expected Behaviour

Excluding layout.cte_bracket rule allows to have the following format as expected:

WITH zoo AS (
    SELECT a FROM foo)

SELECT * FROM zoo

Observed Behaviour

Despite that this query and expected behaviour explicitly documented for LT07 there is some conflict with layout.indent.

Would be helpful to clarify the interplay between these rules and have an option to configure it.

How to reproduce

  1. Create example.sql:
WITH zoo AS (
    SELECT a FROM foo)

SELECT * FROM zoo
  1. Create .sqlfluff:
[sqlfluff]
dialect = bigquery
exclude_rules = layout.cte_bracket
  1. Run linting:
$ sqlfluff lint qwe.sql

Dialect

bigquery

Version

sqlfluff, version 3.0.6
Python 3.12.2 (main, Feb 6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin

Configuration

[sqlfluff]
dialect = bigquery
exclude_rules = layout.cte_bracket

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

@max-ostapenko max-ostapenko added the bug Something isn't working label May 20, 2024
@max-ostapenko max-ostapenko changed the title BgQuery Conflict between Conflict between layout.cte_bracket and layout.indent May 20, 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
Projects
None yet
Development

No branches or pull requests

1 participant