Fix bug where L034 should ignore INSERT or "CREATE TABLE AS SELECT" with CTE
Add test case for merge statement
Showing 1 of 2 files from the diff.
src/sqlfluff/rules/L034.py
changed.
Other files ignored by Codecov
test/fixtures/rules/std_rule_cases/L034.yml
has changed.
@@ -94,10 +94,24 @@
Loading
94 | 94 | "insert_statement", "set_expression" |
|
95 | 95 | ): |
|
96 | 96 | return None |
|
97 | + | if ( |
|
98 | + | len(context.parent_stack) >= 3 |
|
99 | + | and context.parent_stack[-3].is_type("insert_statement", "set_expression") |
|
100 | + | and context.parent_stack[-2].is_type("with_compound_statement") |
|
101 | + | ): |
|
102 | + | return None |
|
97 | 103 | if len(context.parent_stack) >= 3 and context.parent_stack[-3].is_type( |
|
98 | 104 | "create_table_statement", "merge_statement" |
|
99 | 105 | ): |
|
100 | 106 | return None |
|
107 | + | if ( |
|
108 | + | len(context.parent_stack) >= 4 |
|
109 | + | and context.parent_stack[-4].is_type( |
|
110 | + | "create_table_statement", "merge_statement" |
|
111 | + | ) |
|
112 | + | and context.parent_stack[-2].is_type("with_compound_statement") |
|
113 | + | ): |
|
114 | + | return None |
|
101 | 115 | ||
102 | 116 | select_clause_segment = context.segment |
|
103 | 117 | select_target_elements = context.segment.get_children("select_clause_element") |
Files | Coverage |
---|---|
src/sqlfluff | 100.00% |
Project Totals (193 files) | 100.00% |
3549558155
3549558155
3549558155
3549558155
3549558155
3549558155
3549558155
3549558155
3549558155
3549558155
3549558155
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.