Skip to content
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

Broken indentation after formatting #171

Closed
jzhang-dev opened this issue Jan 8, 2023 · 1 comment · Fixed by #173
Closed

Broken indentation after formatting #171

jzhang-dev opened this issue Jan 8, 2023 · 1 comment · Fixed by #173
Labels
bug Something isn't working

Comments

@jzhang-dev
Copy link

I noticed the indentation in the run section of my rule was broken after formatting:

$ snakefmt --version
snakefmt, version 0.8.0
$ cat Snakefile 
rule test:
    input:
        gfa="mdbg.gfa",
    output:
        gfa="mdbg.no_seq.gfa",
    run:
        with open(input.gfa, "rt") as fi, open(output.gfa, "wt") as fo:
            for line in fi:
                if line.startswith("S"):
                    record_type, name, sequence, *__ = line.strip("\n").split(
                        "\t", maxsplit=3
                    )
                    new_line = (
                        "\t".join([record_type, name, "*", f"LN:i:{len(sequence)}"])
                    + "\n"
                                )
                else:
                    new_line = line
                fo.write(new_line)

Please note the line starting with new _line = :

$ snakefmt - < Snakefile 
rule test:
    input:
        gfa="mdbg.gfa",
    output:
        gfa="mdbg.no_seq.gfa",
    run:
        with open(input.gfa, "rt") as fi, open(output.gfa, "wt") as fo:
            for line in fi:
                if line.startswith("S"):
                    record_type, name, sequence, *__ = line.strip("\n").split(
                        "\t", maxsplit=3
                        )
                        new_line = (
                            "\t".join([record_type, name, "*", f"LN:i:{len(sequence)}"])
                        + "\n"
                    )
                else:
                    new_line = line
                fo.write(new_line)
[INFO] All done 🎉
@mbhall88 mbhall88 added the bug Something isn't working label Jan 8, 2023
@mbhall88
Copy link
Member

mbhall88 commented Jan 8, 2023

Sorry about this @jzhang-dev. We've got a few indentation-related problems currently, we'll try and get to the bottom of this soon

mbhall88 added a commit to mbhall88/snakefmt that referenced this issue Jan 31, 2023
mbhall88 added a commit to mbhall88/snakefmt that referenced this issue Jan 31, 2023
* add failing test for snakemake#171

* dont assume lagging indentation is same as middle
mbhall88 added a commit that referenced this issue Feb 2, 2023
* add failing test for #171

* dont assume lagging indentation is same as middle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants