I tried the new nextflow lint sub command on nf co...
# linting
n
I tried the new nextflow lint sub command on nf code and found some issues: 1. The
-harshil-alignment
option does not work correctly for the
input
and
output
sections, and it does the opposite of what's intended.
Copy code
original:
    output:
    tuple val(meta), path("${prefix}.vcf.gz")    , emit: vcf
    tuple val(meta), path("${prefix}.vcf.gz.tbi"), emit: tbi, optional: true
    tuple val(meta), path("${prefix}.vcf.gz.csi"), emit: csi, optional: true
    path  "versions.yml"                         , emit: versions

after nextflow lint -format -harshil-alignment .:
    tuple val(meta), path("${prefix}.vcf.gz"), emit: vcf
    tuple val(meta), path("${prefix}.vcf.gz.tbi"), emit: tbi, optional: true
    tuple val(meta), path("${prefix}.vcf.gz.csi"), emit: csi, optional: true
    path "versions.yml", emit: versions
2. it introduces undesired line breaks that reduce code readability
Copy code
original:    
    def args = task.ext.args   ?: ''
    prefix   = task.ext.prefix ?: "${meta.id}"
    def index = args.contains("--write-index=tbi") || args.contains("-W=tbi") ? "tbi" :
                args.contains("--write-index=csi") || args.contains("-W=csi") ? "csi" :
                args.contains("--write-index") || args.contains("-W") ? "csi" :
                ""

after nextflow lint -format -harshil-alignment .:
    def args = task.ext.args ?: ''
    prefix = task.ext.prefix ?: "${meta.id}"
    def index = args.contains("--write-index=tbi") || args.contains("-W=tbi")
        ? "tbi"
        : args.contains("--write-index=csi") || args.contains("-W=csi")
            ? "csi"
            : args.contains("--write-index") || args.contains("-W")
                ? "csi"
                : ""