forked from sqlfluff/sqlfluff
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLT12.yml
More file actions
56 lines (44 loc) · 1.85 KB
/
Copy pathLT12.yml
File metadata and controls
56 lines (44 loc) · 1.85 KB
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
rule: LT12
test_pass_single_final_newline:
pass_str: "SELECT foo FROM bar\n"
test_fail_no_final_newline:
fail_str: "SELECT foo FROM bar"
fix_str: "SELECT foo FROM bar\n"
test_fail_multiple_final_newlines:
fail_str: "SELECT foo FROM bar\n\n"
fix_str: "SELECT foo FROM bar\n"
test_pass_templated_plus_raw_newlines:
pass_str: "{{ '\n\n' }}\n"
test_pass_templated_consume_whitespace:
pass_str: "select * from {{ 'trim_whitespace_table' -}}\n"
test_fail_templated_consume_whitespace_nothing:
fail_str: "select * from {{ 'trim_whitespace_table' -}}"
fix_str: "select * from {{ 'trim_whitespace_table' -}}\n"
test_fail_templated_consume_whitespace_whitespace:
fail_str: "select * from {{ 'trim_whitespace_table' -}} "
fix_str: "select * from {{ 'trim_whitespace_table' -}}\n"
test_fail_templated_consume_whitespace_extra:
fail_str: "select * from {{ 'trim_whitespace_table' -}}\n\n\n"
fix_str: "select * from {{ 'trim_whitespace_table' -}}\n"
test_fail_templated_plus_raw_newlines:
fail_str: "{{ '\n\n' }}"
fix_str: "{{ '\n\n' }}\n"
test_fail_templated_plus_raw_newlines_extra_newline:
fail_str: "{{ '\n\n' }}\n\n"
fix_str: "{{ '\n\n' }}\n"
test_pass_templated_macro_newlines:
# Tricky because the rendered code ends with two newlines:
# - Literal newline inserted by the macro
# - Literal newline at the end of the file
# The slicing algorithm should treat the first newline as "templated" because
# it was inserted when *expanding* the templated macro call.
pass_str: |
{% macro get_keyed_nulls(columns) %}
{{ columns }}
{% endmacro %}
SELECT {{ get_keyed_nulls("other_id") }}
test_fail_templated_no_newline:
# Tricky because there's no newline at the end of the file (following the
# templated code).
fail_str: "{% if true %}\nSELECT 1 + 1\n{%- endif %}"
fix_str: "{% if true %}\nSELECT 1 + 1\n{%- endif %}\n"