Skip to content

error when docstring-style comments in rule inheritance #1678

@t-silvers

Description

@t-silvers

Snakemake version
7.7.0

Describe the bug
When using rule inheritance as described here, docstring-style comments are not supported. They are supported in rules generally, but here result in an uninformative error (see also #1596).

Minimal example
(taken from #1596)

rule copyfile:
    input: "src1.txt"
    output: "src1_cp.txt"
    shell: "cp -v {input} {output}"

use rule copyfile as copyfile2 with:
    """lorem ipsum
    dolor sit amet
    """
    input: "src2.txt"
    output: "src2_cp.txt"

snakemake fails to parse this rule with the following error:

SyntaxError in line 5 of example.smk:
Expecting a keyword or comment inside a 'use rule ... with:' statement. (example.smk, line 5)
  File "./workflow/Snakefile", line 10, in <module>

Additional context
Removing

    """lorem ipsum
    dolor sit amet
    """

fixes the issue.

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