nf-core / tools

Python package with helper tools for the nf-core community.
https://nf-co.re
MIT License
242 stars 191 forks source link

Values in comments are read when creating template for meta.yml from input options #3286

Open zachary-foster opened 1 week ago

zachary-foster commented 1 week ago

Description of the bug

When running nf-core modules lint --fix, data in meta.yml can be made incorrectly if things that look like inputs appear in comments. For example:

In main.nf for the busco module:

    input:
    tuple val(meta), path('tmp_input/*')
    val mode                              // Required:    One of genome, proteins, or transcriptome
    val lineage                           // Required:    lineage to check against, "auto" enables --auto-lineage instead
    path busco_lineages_path              // Recommended: path to busco lineages - downloads if not set
    path config_file                      // Optional:    busco configuration file

The // Recommended: path to busco causes the - to: {} in meta.yml:

  - - busco_lineages_path:
        type: directory
        description: Path to local BUSCO lineages directory.
    - to: {}

Which causes the following error:

╭─ [✗] 3 Module Tests Failed ────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│              ╷                                ╷                                                                                        │
│ Module name  │ File path                      │ Test message                                                                           │
│╶─────────────┼────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────╴│
│ busco        │ modules/nf-core/busco/main.nf  │ Local copy of module does not match remote                                             │
│ busco        │ modules/nf-core/busco/meta.yml │ Local copy of module does not match remote                                             │
│ busco        │ modules/nf-core/busco/meta.yml │ The meta.yml of the module busco is not valid: 'type' is a required property. Check    │
│              │                                │ the entry for input.                                                                   │
│              ╵                                ╵                                                                                        │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Command used and terminal output

nf-core modules lint --fix busco

System information