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

fix: fix spurious duplicate rule exception when requesting a specific rule from a module that contains local rule inheritance #1631

Merged
merged 1 commit into from May 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion snakemake/workflow.py
Expand Up @@ -474,7 +474,9 @@ def add_rule(
is_overwrite = self.is_rule(name)
if not allow_overwrite and is_overwrite:
raise CreateRuleException(
"The name {} is already used by another rule".format(name)
"The name {} is already used by another rule".format(name),
lineno=lineno,
snakefile=snakefile,
)
rule = Rule(name, self, lineno=lineno, snakefile=snakefile)
self._rules[rule.name] = rule
Expand Down Expand Up @@ -1925,6 +1927,11 @@ def decorate(maybe_ruleinfo):
)
else:
# local inheritance
if self.modifier.skip_rule(name_modifier):
# The parent use rule statement is specific for a different particular rule
# hence this local use rule statement can be skipped.
return

if len(rules) > 1:
raise WorkflowError(
"'use rule' statement from rule in the same module must declare a single rule but multiple rules are declared."
Expand Down