Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/lib/test/fixtures/rules/std_rule_cases/AL07.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,12 @@ test_fail_no_copy_code_out_of_template:
# The rule wants to replace "t" with "foobar", but
# LintFix.has_template_conflicts() correctly prevents it copying code out
# of the templated region. Hence, the query is not modified.
ignored: "jinja is not supported"
fail_str: |
SELECT t.repo_id
FROM {{ source_table }} AS t
configs:
core:
templater: jinja
templater:
jinja:
context:
Expand Down
4 changes: 2 additions & 2 deletions crates/lib/test/fixtures/rules/std_rule_cases/CP01.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,16 @@ test_pass_ignore_words_complex:
ignore_words_regex: (^Se|^Fr)

test_pass_ignore_templated_code_true:
ignored: "jinja is not set"
pass_str: |
{{ "select" }} a
FROM foo
WHERE 1
configs:
core:
templater: jinja
ignore_templated_areas: true

test_fail_ignore_templated_code_false:
ignored: "jinja is not supported"
fail_str: |
{{ "select" }} a
FROM foo
Expand All @@ -143,6 +142,7 @@ test_fail_ignore_templated_code_false:
where 1
configs:
core:
templater: jinja
ignore_templated_areas: false

test_fail_snowflake_group_by_cube:
Expand Down
2 changes: 1 addition & 1 deletion crates/lib/test/fixtures/rules/std_rule_cases/CP03.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ test_pass_ignore_templated_code_true:
ignore_templated_areas: true

test_fail_ignore_templated_code_false:
ignored: "jinja is not supported"
fail_str: |
SELECT
{{ "greatest(a, b)" }},
Expand All @@ -76,6 +75,7 @@ test_fail_ignore_templated_code_false:
greatest(i, j)
configs:
core:
templater: jinja
ignore_templated_areas: false

test_pass_func_name_templated_literal_mix:
Expand Down
18 changes: 10 additions & 8 deletions crates/lib/test/fixtures/rules/std_rule_cases/CV10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,12 @@ test_pass_partially_templated_quoted_literals_simple:
preferred_quoted_literal_style: double_quotes

test_fail_partially_templated_quoted_literals_simple:
ignored: "jinja is not supported"
fail_str: |
SELECT '{{ "a string" }}'
configs:
core:
dialect: bigquery
templater: jinja
rules:
convention.quoted_literals:
preferred_quoted_literal_style: double_quotes
Expand All @@ -310,17 +310,18 @@ test_pass_partially_templated_quoted_literals_complex:
configs:
core:
dialect: bigquery
templater: jinja
rules:
convention.quoted_literals:
preferred_quoted_literal_style: double_quotes

test_fail_partially_templated_quoted_literals_complex:
ignored: "jinja is not supported"
fail_str: |
SELECT 'this_is_a_lintable_{{ "string" }}'
configs:
core:
dialect: bigquery
templater: jinja
rules:
convention.quoted_literals:
preferred_quoted_literal_style: double_quotes
Expand All @@ -331,23 +332,23 @@ test_pass_partially_templated_quoted_literals_with_multiple_templates:
configs:
core:
dialect: bigquery
templater: jinja
rules:
convention.quoted_literals:
preferred_quoted_literal_style: double_quotes

test_fail_partially_templated_quoted_literals_with_multiple_templates:
ignored: "jinja is not supported"
fail_str: |
SELECT 'this_{{ "is" }}_{{ "a_lintable" }}_{{ "string" }}'
configs:
core:
dialect: bigquery
templater: jinja
rules:
convention.quoted_literals:
preferred_quoted_literal_style: double_quotes

test_fail_partially_templated_quoted_literals_inside_blocks:
ignored: "jinja is not supported"
fail_str: |
SELECT
{% if true %}
Expand All @@ -356,52 +357,53 @@ test_fail_partially_templated_quoted_literals_inside_blocks:
configs:
core:
dialect: bigquery
templater: jinja
rules:
convention.quoted_literals:
preferred_quoted_literal_style: double_quotes

test_pass_fully_templated_quoted_literals_are_ignored:
ignored: "jinja is not set"
pass_str: |
SELECT {{ "'a_non_lintable_string'" }}
configs:
core:
dialect: bigquery
templater: jinja
rules:
convention.quoted_literals:
preferred_quoted_literal_style: double_quotes

test_pass_partially_templated_literals_are_ignored_when_some_quotes_are_inside_the_template_1:
ignored: "jinja is not set"
pass_str: |
SELECT '{{ "string' FROM table1" }}
configs:
core:
dialect: bigquery
templater: jinja
rules:
convention.quoted_literals:
preferred_quoted_literal_style: double_quotes

test_pass_partially_templated_literals_are_ignored_when_some_quotes_are_inside_the_template_2:
ignored: "jinja is not set"
pass_str: |
{{ "SELECT 'stri" -}}ng' FROM table1
configs:
core:
dialect: bigquery
templater: jinja
rules:
convention.quoted_literals:
preferred_quoted_literal_style: double_quotes

test_pass_prefix_chars_are_correctly_detected_as_unlintable:
ignored: "jinja is not set"
pass_str: |
SELECT
r{{ "''" }},
r{{ "'project' FROM table1" }}
configs:
core:
dialect: bigquery
templater: jinja
rules:
convention.quoted_literals:
preferred_quoted_literal_style: double_quotes
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ test_pass_parenthesis_block_isolated:
SELECT * FROM (SELECT 1 AS C1) AS T1;

test_pass_parenthesis_block_isolated_template:
ignored: "jinja is not supported"
pass_str: |
{{ 'SELECT * FROM (SELECT 1 AS C1) AS T1;' }}
configs:
core:
templater: jinja
ignore_templated_areas: false

test_fail_parenthesis_block_not_isolated:
Expand Down
6 changes: 3 additions & 3 deletions crates/lib/test/fixtures/rules/std_rule_cases/LT01-commas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,32 @@ test_fail_whitespace_before_comma_template:
ignore_templated_areas: false

test_pass_errors_only_in_templated_and_ignore:
ignored: "jinja is not supported"
pass_str: |
{{ 'SELECT 1 ,4' }}, 5, 6
configs:
core:
templater: jinja
ignore_templated_areas: true

test_fail_errors_only_in_non_templated_and_ignore:
ignored: "jinja is not supported"
fail_str: |
{{ 'SELECT 1, 4' }}, 5 , 6
fix_str: |
{{ 'SELECT 1, 4' }}, 5, 6
configs:
core:
templater: jinja
ignore_templated_areas: true

test_pass_single_whitespace_after_comma:
pass_str: SELECT 1, 4

test_pass_single_whitespace_after_comma_template:
ignored: "jinja is not supported"
pass_str: |
{{ 'SELECT 1, 4' }}
configs:
core:
templater: jinja
ignore_templated_areas: false

test_fail_multiple_whitespace_after_comma:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ test_basic:
pass_str: SELECT 1

test_basic_template:
ignored: "jinja is not supported"
pass_str: |
{{ 'SELECT 1' }}
configs:
core:
templater: jinja
ignore_templated_areas: false

test_basic_fix:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ pass_concat_string:
test_pass_placeholder_spacing:
# Test for spacing issues around placeholders
# https://github.com/sqlfluff/sqlfluff/issues/4253
ignored: "jinja is not supported"
pass_str: |
{% set is_dev_environment = true %}

Expand All @@ -108,6 +107,9 @@ test_pass_placeholder_spacing:
{% endif %}
AND TRUE
;
configs:
core:
templater: jinja

fail_bigquery_whitespaces_in_function_reference:
fail_str: SELECT dataset . AddFourAndDivide(5, 10)
Expand Down
12 changes: 9 additions & 3 deletions crates/lib/test/fixtures/rules/std_rule_cases/LT01-trailing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,24 @@ test_fail_trailing_whitespace_on_initial_blank_line:


test_pass_trailing_whitespace_before_template_code:
ignored: "jinja is not supported"
pass_str: |
SELECT
{% for elem in ["a", "b"] %}
{{ elem }},
{% endfor %}
0
configs:
core:
templater: jinja

test_fail_trailing_whitespace_and_whitespace_control:
ignored: "jinja is not supported"
fail_str: "{%- set temp = 'temp' -%}\n\nSELECT\n 1, \n 2,\n"
fix_str: "{%- set temp = 'temp' -%}\n\nSELECT\n 1,\n 2,\n"
configs:
core:
templater: jinja

test_pass_macro_trailing:
ignored: "jinja is not supported"
pass_str: |
{% macro foo(bar) %}
{{bar}}
Expand All @@ -41,3 +44,6 @@ test_pass_macro_trailing:

select *
from tbl
configs:
core:
templater: jinja
Loading
Loading