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

Comment in multi-line parenthesis breaks Black #242

Open
lczech opened this issue Jul 11, 2024 · 1 comment
Open

Comment in multi-line parenthesis breaks Black #242

lczech opened this issue Jul 11, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@lczech
Copy link

lczech commented Jul 11, 2024

This might be an issue with Black, but not sure.

Minimal example:

rule my_rule:
    input:
        data=(
            # a comment on the below
            "input_1.txt"
            if condition
            else "input_2.txt"
        )

Obviously, this is not good style, and the comment should go before the the data line anyway - which is what I'll do to fix this. However, it still should not break the formatting.

Error:

snakefmt.exceptions.InvalidPython: Black error:
Cannot parse: 2:0: EOF in multi-line statement

Python itself does not complain about this, and so I think neither should do the formatter, despite the bad style, and instead just simply move the comment up, as it does in similar situations without parenthesis.

@mbhall88
Copy link
Member

I suspect this is not a black issue, but an issue with the way we pass it to black.

@mbhall88 mbhall88 added the bug Something isn't working label Jul 11, 2024
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

No branches or pull requests

2 participants