forked from sqlfluff/sqlfluff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AL02.yml
112 lines (101 loc) · 2.54 KB
/
AL02.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
rule: AL02
issue_561:
# Test for https://github.com/sqlfluff/sqlfluff/issues/561
pass_str: |
select
array_agg(catalog_item_id) within group
(order by product_position asc) over (partition by (event_id, shelf_position))
as shelf_catalog_items
from x
configs:
core:
dialect: snowflake
test_fail_explicit_column_default:
# Test explicit column alias
fail_str: select 1 bar from table1 b
fix_str: select 1 AS bar from table1 b
test_fail_explicit_column_explicit:
# Test explicit column alias
fail_str: select 1 bar from table1 b
fix_str: select 1 AS bar from table1 b
configs:
rules:
aliasing.column:
aliasing: explicit
test_fail_explicit_column_implicit:
# Test explicit column alias
fail_str: select 1 AS bar from table1 b
fix_str: select 1 bar from table1 b
configs:
rules:
aliasing.column:
aliasing: implicit
test_pass_tsql_alternative_alias:
# Test explicit column alias
pass_str: select alias1 = col1
configs:
core:
dialect: tsql
test_fail_alias_ending_equals:
# Test explicit column alias doesn't catch false positives
fail_str: select col1 "example="
fix_str: select col1 AS "example="
test_fail_alias_ending_raw_equals:
# Test explicit column alias doesn't catch false positives
fail_str: select col1 raw_equals
fix_str: select col1 AS raw_equals
test_alias_expression_align_4515_1:
# Test more failing alias expressions
fail_str: |
select
test a
from example_table
fix_str: |
select
test AS a
from example_table
configs:
layout:
type:
alias_expression:
spacing_before: align
align_within: select_clause
align_scope: bracketed
test_alias_expression_align_4515_2:
# Test more failing alias expressions
fail_str: |
select
test a,
test b
from example_table
fix_str: |
select
test AS a,
test AS b
from example_table
configs:
layout:
type:
alias_expression:
spacing_before: align
align_within: select_clause
align_scope: bracketed
test_alias_expression_align_4515_3:
# Test more failing alias expressions
fail_str: |
select
testy_testy_testy a,
test b
from example_table
fix_str: |
select
testy_testy_testy AS a,
test AS b
from example_table
configs:
layout:
type:
alias_expression:
spacing_before: align
align_within: select_clause
align_scope: bracketed