snakefmt icon indicating copy to clipboard operation
snakefmt copied to clipboard

Formatter mess up if-else statements indention

Open y9c opened this issue 3 years ago • 4 comments

Take this input as an example, by running snakefmt, the indent will be wrong.

rule cutadapt:
    input:
        "a.txt"
    output:
        "b.txt"
    run:
        if (  
             "xxxxxxxxxxxxxxxxxxxxxx" not in wildcards.rn                
               and "yyyyyyyyyyyyyyyyyyyyyyyyyy" not in wildcards.rn 
           ):                                                                                                                 
            shell(
            """ 
            cutadapt \
                -m 30 \
                {input} \
                -o {output}
            """
            )
        else:
            shell(
            """
            cutadapt \
                {input} \
                -o {output}
            """
            )

y9c avatar Jul 09 '22 01:07 y9c

New space will be added on each run.

y9c avatar Jul 09 '22 01:07 y9c

I figure out that the cause is from the if statment, which is too long.

y9c avatar Jul 09 '22 01:07 y9c

This is probably a result of #151 I suspect. I'll try and take a look at it this week sorry.

mbhall88 avatar Jul 10 '22 22:07 mbhall88

This is not related to #151 in the end. Its a bit trickier. Leave it with me and I'll try get to the bottom of it soon.

mbhall88 avatar Jul 13 '22 22:07 mbhall88

This will be fixed in the next release

mbhall88 avatar Nov 08 '22 06:11 mbhall88