Skip to content

Commit

Permalink
fix: check for skipped rules in case of local rule inheritance (#1631)
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed May 4, 2022
1 parent 42fc9de commit 9083ac1
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit 9083ac1

Please sign in to comment.