Description of the bug
When a subworkflow includes another subworkflow using the full path (e.g., ../../../subworkflows/nf-core/vcf_gather_bcftools), the linter incorrectly converts underscores in the component name to slashes, producing vcf/gather/bcftools instead of vcf_gather_bcftools.
This happens because get_components_to_install() in components_utils.py uses link.startswith("../../../") to identify nf-core components and then unconditionally splits on underscores and rejoins with slashes. This works for modules (where bcftools/mpileup maps to the directory structure), but subworkflow directory names use underscores (vcf_gather_bcftools), not nested directories.
Subworkflow-to-subworkflow includes via relative paths (../vcf_gather_bcftools) work correctly because they hit the elif link.startswith("../") branch which preserves the underscore name.
Minimal reproducible example
A subworkflow main.nf with:
include { VCF_GATHER_BCFTOOLS } from '../../../subworkflows/nf-core/vcf_gather_bcftools'
And meta.yml with:
components:
- vcf_gather_bcftools
Produces lint error:
meta_include: Included module/subworkflow `vcf/gather/bcftools` missing in meta.yml
Root cause
In nf_core/components/components_utils.py line 164-170:
if link.startswith("../../../"):
name_split = name.lower().split("_")
component_name = "/".join(name_split)
...
modules[component_name] = component_dict
This branch handles all ../../../ includes identically, but subworkflow includes via ../../../subworkflows/nf-core/... should preserve underscores and be added to subworkflows, not modules.
Context
Encountered in nf-core/modules#10283 which adds a new subworkflow that includes vcf_gather_bcftools via the full path.
Related to #4030 (closed - about module names with underscores), but this is distinct: subworkflow names inherently use underscores.
Suggested fix
Check whether the link path contains subworkflows/ before deciding how to derive the component name.
Description of the bug
When a subworkflow includes another subworkflow using the full path (e.g.,
../../../subworkflows/nf-core/vcf_gather_bcftools), the linter incorrectly converts underscores in the component name to slashes, producingvcf/gather/bcftoolsinstead ofvcf_gather_bcftools.This happens because
get_components_to_install()incomponents_utils.pyuseslink.startswith("../../../")to identify nf-core components and then unconditionally splits on underscores and rejoins with slashes. This works for modules (wherebcftools/mpileupmaps to the directory structure), but subworkflow directory names use underscores (vcf_gather_bcftools), not nested directories.Subworkflow-to-subworkflow includes via relative paths (
../vcf_gather_bcftools) work correctly because they hit theelif link.startswith("../")branch which preserves the underscore name.Minimal reproducible example
A subworkflow
main.nfwith:include { VCF_GATHER_BCFTOOLS } from '../../../subworkflows/nf-core/vcf_gather_bcftools'And
meta.ymlwith:Produces lint error:
Root cause
In
nf_core/components/components_utils.pyline 164-170:This branch handles all
../../../includes identically, but subworkflow includes via../../../subworkflows/nf-core/...should preserve underscores and be added tosubworkflows, notmodules.Context
Encountered in nf-core/modules#10283 which adds a new subworkflow that includes
vcf_gather_bcftoolsvia the full path.Related to #4030 (closed - about module names with underscores), but this is distinct: subworkflow names inherently use underscores.
Suggested fix
Check whether the link path contains
subworkflows/before deciding how to derive the component name.