Skip to content

Have linting to detect pathvar anti-patterns #4149

@irm-codebase

Description

@irm-codebase

(original issue: snakemake/snakefmt#283)

Is your feature request related to a problem? Please describe.
Using pathvars might introduce issues if devs are not pristine in how they add them to rules.
For example, if you forget to add <resources>/... to just one rule input, you'll end up with a file placed outside of wherever you re-route <resources> to.

This is often hard to track in large enough workflows.

Describe the solution you'd like
It'd be nice to have a linting option that tests that all rules in a workflow make use of pathvars, at least for <resources>, <logs>, and <results>.
Additionally, it'd also be useful to check that custom pathvars also respect default pathvars to avoid anti-patterns

Suggested checks:

  1. all rule logs, inputs, outputs and benchmarks start with their equivalent <> default (e.g., inputs start with <resources>) or a custom alternative (e.g., an input could be <user_shapes>).
  2. Custom pathvar defaults respect generic pathvars via nesting (so that if they are unspecified, their default respects them)
pathvars:
    # will still respect the 'resources' pathvar if not specified
    user_shapes="<resources>/user/{shapes}/shapes.parquet",

Describe alternatives you've considered
Lots of visual inspection, I suppose?

Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions