-
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
Serious bug: Code after comment in indented if-block is unindented, changing execution #159
Comments
Same problem applies to if config.get("s3_dst"):
include: "workflow/snakemake_rules/upload.smk"
include: "workflow/snakemake_rules/trigger.smk"
"""test"""
include: "workflow/snakemake_rules/trigger.smk" becomes if config.get("s3_dst"):
include: "workflow/snakemake_rules/upload.smk"
include: "workflow/snakemake_rules/trigger.smk"
"""test"""
include: "workflow/snakemake_rules/trigger.smk" |
This bug got introduced in v0.3.0 - before that, in version 0.2.6 one gets an error instead:
So this is an old bug. I noticed in code review that some code got changed in a way that it shouldn't - hard to notice when a whole Snakefile gets formatted by snakefmt. |
Good catch! I think the discussion is ongoing in #157, so let's talk there. |
This was referenced Dec 7, 2022
Merged
Merged
Merged
v0.8.0 should fix this 🤞 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's a serious bug in v0.7.0 present since 0.3.0
If you have an if statement followed by an indented block, and that block contains a line comment with
#
, then Snakefmt unindents everything starting from the first#
which changes the code execution logic. This is a fatal bug for a code formatter: code formatters must not change the code they format.The reproducible code is the same as for #157:
Start, this is what I want:
After formatting:
But this is still not ok per Snakefmt, if I save again:
Note: the last
include
is now unindented, which changes the logic significantly.The text was updated successfully, but these errors were encountered: