sqlfmt
sqlfmt copied to clipboard
Unstable indentation in jinja `set` tag with triple-quoted, multiline strings
sqlfmt
keeps adding \tab before every line wrapped with triple quotes.
Reproduce steps.
One can define a macro, say, to select columns depending on key
:
{% macro test(key) %}
{% set columns_by_source = {
"a": """
column_a1,
column_a2,
column_a3,
""",
"b": """
column_b1,
column_b2,
""",
} %}
....
{% endmacro %}
Now every time, running sqlfmt -k -l 80 .
, sqlfmt
will add \tab
before each line continuously moving rows right.
Locally you can skip -k
flag, but then if you have .pre-commit
hooks in GitHub, it might prevent from merging as sqlfmt
check will always fail.
What is the output of sqlfmt --version
?
rev: v0.21.3
hooks:
- id: sqlfmt
language_version: python
additional_dependencies: ['.[jinjafmt]']