snakefmt icon indicating copy to clipboard operation
snakefmt copied to clipboard

edge case: shell cmd prefix

Open siebrenf opened this issue 3 years ago • 1 comments

We use some... unconventional... syntax in several rules. This may not even be worth your attention, but FYI.

minimal example:

rule break_snakefmt_044:
    shell:
        ("conditional prefix" if True else "") +
        """\
        cmd
        """

error:

snakefmt.exceptions.InvalidPython: Got error:
'''
Cannot parse: 1:40: ("conditional prefix" if True else "") +
'''
while formatting code with black.

P.S. This was the last issue I found while formatting our code 🎉

siebrenf avatar Dec 06 '21 18:12 siebrenf

Similar problem:

rule:
    input:
        "input.ext"
    output:
        "output.ext"
    shell:
        get_cmd(config, "command")
        "--arg test"
snakefmt.exceptions.InvalidParameterSyntax: 31get_cmd(config, "command")
"--arg test"

gipert avatar Feb 05 '25 10:02 gipert