sqlfluff: `sqlfluff fix` corrupts Jinja for loop
Expected Behaviour
Output should be semantically equivalent to input, and have valid syntax.
Observed Behaviour
Output seems to be corrupted.
Steps to Reproduce
$ printf 'SELECT\n 1,\n{%% for _ in [1, 2, 3] %%} 2,{%%endfor %%}\n' | sqlfluff fix -
Unfixable violations detected.
SELECT
1,
{% for _ in [1, 2, 3] %}
{%endfor %}
Note that the contents of the for
loop was completely deleted.
Slightly varying the input causes the output to be corrupted in other ways (e.g. 2
is present but the comma is not, or the 2
is duplicated multiple times).
Dialect
None specified
Version
SQLFluff ce4e5a344526f7ee61a0950adc079e4d3b5af438, Python 3.9.7
Configuration
None
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 25 (25 by maintainers)
Thanks, @CyberShadow! I have a draft PR that addresses the initial issue. The duplicated “2” example still fails. I’ll see if I can find a solution for that as well.
No that’s fine. Just confused me for a second.
Seems similar to #1162 and in particular this comment: https://github.com/sqlfluff/sqlfluff/issues/1162#issuecomment-914611474