question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Formatter mess up if-else statements indention

See original GitHub issue

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}
            """
            )

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mbhall88commented, Jul 13, 2022

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.

0reactions
mbhall88commented, Nov 8, 2022

This will be fixed in the next release

Read more comments on GitHub >

github_iconTop Results From Across the Web

Indentation of an IF-ELSE block in Python - Stack Overflow
The accepted answer is showing an example that the else statement must be indented at the same level as the if statement-- and...
Read more >
If-Else statements auto-indent with each else statement #5396
The AL Formatter formats if-else statements by increasing the indentation for each case. This results in e.g. nested statements to confuse those ...
Read more >
What is the formatting for if/else statements? (Semicolons and ...
i have a question on the if…else statement …why we didn't put a semi-colon after the code block of else statement for example:...
Read more >
Indentation Error in Python | How to Solve it - Edureka
This article will provide you with a detailed understanding of Indentation error in Python and the solutions to avoid the same.
Read more >
Python Indentation - W3Schools
Python Indentation. Indentation refers to the spaces at the beginning of a code line. Where in other programming languages the indentation in code...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found