JetBrains-Research / snakecharm

Plugin for PyCharm / IntelliJ IDEA Platform IDEs which adds support for Snakemake language.
MIT License
61 stars 7 forks source link

Warn of not all params are overriden in `params` section #482

Open iromeo opened 2 years ago

iromeo commented 2 years ago

E.g. get runtime error:

RuleException in line 3 of /Users/romeo/work/snakecharm/snakemaek_examples/untitled10/rule_001_use_check/template_module_001.smk:
'Params' object has no attribute 'p'

for

import os
print(os.cpu_count())

module m_001:
    snakefile: "template_module_001.smk"
    config: dict(key="foo")

use rule m_001 from m_001 as *_new with:
    input:
        "foo.txt"
    params:
        k = "custom"

rule all:
    input: "001_foo.hg38.txt"
    default_target: True

In module:

FOO_001 = config['key']

rule m_001:
    output: "001_"f"{FOO_001}"".{genome}.txt"
    params:
        p = lambda wildcards, resources: resources.threads,
        p2 = lambda wildcards, resources: resources.threads2,
        k = "default"
    resources:
        threads = "a",
        threads2 = lambda wildcards, threads: threads
    threads: 3
    shell:
        "(echo {input:q}; echo 'thr'={threads}; "
        "echo 'p='{params.p}; echo 'p2='{params.p2};"
        "echo 'k='{params.k};"
        " echo 'done') > {output}"