Skip to content

Long parenthesis within rule settings breaks code #240

Open
@lczech

Description

@lczech

This is with snakefmt v0.10.2.

Minimal example:

rule call_variants:
    input:
        some_file
    threads:
        max(
            1,
            int(config["params"]["call_variants"]["threads"]) -
            int(config["params"]["call_variants"]["compress-threads"])
        )

gets reformatted to

rule call_variants:
    input:
        some_file,
    threads: max(
    1,
    int(config["params"]["call_variants"]["threads"])
    - int(config["params"]["call_variants"]["compress-threads"]),
)

This cannot be parsed again, as calling snakefmt again on this yields:

snakefmt.exceptions.InvalidParameterSyntax: 5max(

The issue is only appearing due to the long lines. Removing this, computing the needed value beforehand, and instead just having a shorter statement there, works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions