Skip to content

Comment in multi-line parenthesis breaks Black #242

Open
@lczech

Description

@lczech

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.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions