Skip to content
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

jinjafmt adds trailing comma to macro args, breaking it #156

Closed
tconbeer opened this issue Mar 30, 2022 · 2 comments · Fixed by #181
Closed

jinjafmt adds trailing comma to macro args, breaking it #156

tconbeer opened this issue Mar 30, 2022 · 2 comments · Fixed by #181
Labels
bug Something isn't working
Milestone

Comments

@tconbeer
Copy link
Owner

Describe the bug
Jinja doesn't like trailing commas in macro arguments (?) but black inserts them when the args wrap to multiple lines

To Reproduce

{%- macro my_macro(
    arg_here,
    kwarg1=true,
    kwarg2="''",
    kwarg3="model",
    kwarg4="permanent",
    kwarg5=256
) -%}

Expected behavior

{%- macro my_macro(
    arg_here,
    kwarg1=true,
    kwarg2="''",
    kwarg3="model",
    kwarg4="permanent",
    kwarg5=256
) -%}

Actual behavior

{%- macro my_macro(
    arg_here,
    kwarg1=true,
    kwarg2="''",
    kwarg3="model",
    kwarg4="permanent",
    kwarg5=256,
) -%}

Unfortunately this doesn't compile because of the trailing comma after 256

Additional context
What is the output of sqlfmt --version?
0.6.0

@tconbeer tconbeer added the bug Something isn't working label Mar 30, 2022
@tconbeer tconbeer changed the title jinjafmt adds magic trailing comma to macro args, breaking it jinjafmt adds trailing comma to macro args, breaking it Mar 31, 2022
@tconbeer tconbeer added this to the v0.9.0 milestone May 5, 2022
@mitchbregs
Copy link

Can't wait for 0.9.0!!!

@tconbeer
Copy link
Owner Author

tconbeer commented Jun 2, 2022

@mitchbregs released!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants