forked from sqlfluff/sqlfluff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LT11.yml
114 lines (98 loc) · 2.27 KB
/
LT11.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
rule: LT11
test_fail_simple_fix_union_all_before:
fail_str: |
SELECT 'a' UNION ALL
SELECT 'b'
fix_str: |
SELECT 'a'
UNION ALL
SELECT 'b'
test_fail_simple_fix_union_all_after:
fail_str: |
SELECT 'a'
UNION ALL SELECT 'b'
fix_str: |
SELECT 'a'
UNION ALL
SELECT 'b'
test_fail_simple_fix_union_all_before_and_after:
fail_str: |
SELECT 'a' UNION ALL SELECT 'b'
fix_str: |
SELECT 'a'
UNION ALL
SELECT 'b'
test_pass_multiple_newlines_are_allowed:
pass_str: |
SELECT 'a'
UNION ALL
SELECT 'b'
# The autofix of LT11 doesn't respect indentation of the surrounding query.
# Hence, the fix result of only LT11 looks ugly. But LT02 will fix the indentation
# in a second step.
# See the test blow.
test_fail_fix_works_in_subqueries:
fail_str: |
SELECT * FROM (
SELECT 'g' UNION ALL
SELECT 'h'
UNION ALL SELECT 'j'
)
fix_str: |
SELECT * FROM (
SELECT 'g'
UNION ALL
SELECT 'h'
UNION ALL
SELECT 'j'
)
# Test autofix after LT02 passes LT11
test_pass_fix_works_in_subqueries_after_LT02_fix:
pass_str: |
SELECT * FROM (
SELECT 'g'
UNION ALL
SELECT 'h'
UNION ALL
SELECT 'j'
)
test_fail_simple_fix_union_before_and_after:
fail_str: |
SELECT 'a' UNION SELECT 'b'
fix_str: |
SELECT 'a'
UNION
SELECT 'b'
test_fail_simple_fix_intersect_before_and_after:
fail_str: |
SELECT 'a' INTERSECT SELECT 'b'
fix_str: |
SELECT 'a'
INTERSECT
SELECT 'b'
test_fail_simple_fix_except_before_and_after:
fail_str: |
SELECT 'a' EXCEPT SELECT 'b'
fix_str: |
SELECT 'a'
EXCEPT
SELECT 'b'
test_fail_simple_fix_minus_before_and_after:
fail_str: |
SELECT 'a' EXCEPT SELECT 'b'
fix_str: |
SELECT 'a'
EXCEPT
SELECT 'b'
test_fail_simple_fix_bigquery_intersect_distinct_before_and_after:
fail_str: |
SELECT 'a' INTERSECT DISTINCT SELECT 'b'
fix_str: |
SELECT 'a'
INTERSECT DISTINCT
SELECT 'b'
configs:
core:
dialect: bigquery
# NOTE: We used to exclude TSQL from fixing these queries, but
# the reflow logic now enables this.