New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix keep adding new line on wrong place #2822
Comments
Is this correct? If so that is a VERY old version so please upgrade. Though confirmed this is still an issue in latest. But still, going to need to upgrade to get any fix for this. |
Thanks for your response! I had sqlfluff globally installed with version 0.6.2 but i changed it now to 0.11.0 and still it is the same issue. |
The rule probably needs updating to be "template aware". A few other rules have required similar updates and may provide useful inspiration for a fix.
|
I can't reproduce this issue with SQLFluff 0.11.0. This is the terminal output I get:
And this is the resulting file. SQLFluff indented line 2 but no newline was added.
|
I can @barrywhart but it only works when the final newline in the file doesn't exist. If on mac you can run something like this to strip the final newline character:
Then fix |
There's a bug in |
Search before asking
What Happened
To replicate this issue you can create a file eg. test.template.sql
then run:
This will give you:
And the result of the file is now:
If i run it again it will complain on the same issue and the result of the file would be:
And so on.
Expected Behaviour
The expected behavior would be to add the new line at the end of the file, that is after
{%- endif %}
instead of adding the new line at the end of the SQL query - so the result should look like this:Observed Behaviour
Adds a new line to the end of the SQL query instead of in the end of the file.
How to reproduce
Already mentioned above (in What Happened section).
Dialect
snowflake
Version
sqlfluff, version 0.6.2
Configuration
[sqlfluff]
verbose = 1
dialect = snowflake
templater = jinja
exclude_rules = L027,L031,L032,L036,L044,L046,L034
output_line_length = 121
sql_file_exts=.sql
[sqlfluff:rules]
tab_space_size = 4
max_line_length = 250
indent_unit = space
comma_style = trailing
allow_scalar = True
single_table_references = consistent
unquoted_identifiers_policy = aliases
[sqlfluff:rules:L010] # Keywords
capitalisation_policy = upper
[sqlfluff:rules:L014]
extended_capitalisation_policy = lower
[sqlfluff:rules:L030] # function names
capitalisation_policy = upper
Are you willing to work on and submit a PR to address the issue?
Code of Conduct
The text was updated successfully, but these errors were encountered: