-
Notifications
You must be signed in to change notification settings - Fork 29
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
Wrong indentation for multi-line if statement at file level #40
Comments
Gah. I'm struggling to think what is readable here. Should we have 2 lines between the python code and the nested |
Also, thanks @enixmail for spotting ;-) |
One line before the function, two lines after |
When snakemake keywords are inside python code, they get 1 newline between keywords, and two newlines when going from keyword back to code. This mirrors black when formatting functions not at indent level 0.
When snakemake keywords are inside python code, they get 1 newline between keywords, and two newlines when going from keyword back to code. This mirrors black when formatting functions not at indent level 0.
I think using black as a guide is a safe bet. |
* Requires dealing with lone 'if a:' or 'else:' which break python syntax * Solves #40 * Will break on 'for:' or 'while:'
Alrighty with the latest commits (on
So implemented the black-like one line spacing in indented context, two line spacing at top leve. Also the first if condition gets formatted, this is now generic to all python statements preceding snakemake code in nested contexts. Note for your specific example the line is short enough to get collapsed, but make it longer and you get
So looking dandy! I will close if you're happy with this. |
When having a multi-lines if statement at file level, the second and following lines are not indented.
Note: this was ran from commit 9919e4b
Given this Snakefile:
snakefmt
formats it this way:Also, to be discussed in #38 I guess, blank lines are removed between the end of the rule and the
elif
orelse
keywords (should it be 2 blank lines as a top element or simply because of therules
inside?).The text was updated successfully, but these errors were encountered: