forked from sqlfluff/sqlfluff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CV07.yml
80 lines (70 loc) · 1.83 KB
/
CV07.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
rule: CV07
test_pass_no_outer_brackets:
pass_str: |
SELECT foo
FROM bar
test_fail_outer_brackets:
fail_str: |
(SELECT foo
FROM bar)
fix_str: |
SELECT foo
FROM bar
test_fail_outer_brackets_inner_subquery:
fail_str: |
(SELECT foo
FROM (select * from bar))
fix_str: |
SELECT foo
FROM (select * from bar)
test_pass_set_statement_brackets:
pass_str: |
(SELECT 1)
UNION
(SELECT 1)
test_pass_no_outer_brackets_tsql:
pass_str: |
SELECT foo
FROM bar
configs:
core:
dialect: tsql
test_fail_outer_brackets_tsql:
fail_str: |
(SELECT foo
FROM bar)
fix_str: |
SELECT foo
FROM bar
configs:
core:
dialect: tsql
test_fail_outer_brackets_inner_subquery_tsql:
fail_str: |
(SELECT foo
FROM (select * from bar))
fix_str: |
SELECT foo
FROM (select * from bar)
configs:
core:
dialect: tsql
test_pass_begin_end_statement_brackets_tsql:
pass_str: |
BEGIN
(SELECT 1)
END
configs:
core:
dialect: tsql
test_fail_leading_trailing_whitespace:
# This previously caused the post-fix parse check to fail.
fail_str: "(\n SELECT\n foo,\n bar,\n baz\n FROM mycte2\n);\n"
# Yes, the formatting looks bad, but that's because we're only running CV07
# here. In the real world, other rules will tidy up the formatting.
fix_str: "\n SELECT\n foo,\n bar,\n baz\n FROM mycte2\n;\n"
test_fail_leading_whitespace_and_comment:
fail_str: "( -- This\n SELECT\n foo,\n bar,\n baz\n FROM mycte2\n)\n"
# Yes, the formatting looks bad, but that's because we're only running CV07
# here. In the real world, other rules will tidy up the formatting.
fix_str: " -- This\n SELECT\n foo,\n bar,\n baz\n FROM mycte2\n\n"