Skip to content

Conversation

@ammaraziz
Copy link

A common gotcha when creating a new module using the nf-core template is the prefix variable is created using def keyword, which creates a local variable (in this case the script block).

output:
    tuple val(meta), path("${prefix}.perfile.tsv"),     optional:true, emit: summary

    script:
    ...
    def prefix = task.ext.prefix ?: "${meta.id}"

But common usage of prefix extends outside of local scope. The gotcha is the combination of using def and a nextflow process containing multiple scoping blocks.

This tiny pull request adds a comment to assist and remind people of this gotcha.

PR checklist

  • This comment contains a description of changes (with reason)
  • CHANGELOG.md is updated -> I have not updated changelog.md, is this needed for such a tiny change?

@github-actions
Copy link
Contributor

This PR is against the main branch ❌

  • Do not close this PR
  • Click Edit and change the base to dev
  • This CI test will remain failed until you push a new commit

Hi @ammaraziz,

It looks like this pull-request is has been made against the ammaraziz/tools main branch.
The main branch on nf-core repositories should always contain code from the latest release.
Because of this, PRs to main are only allowed if they come from the ammaraziz/tools dev branch.

You do not need to close this PR, you can change the target branch to dev by clicking the "Edit" button at the top of this page.
Note that even after this, the test will continue to show as failing until you push a new commit.

Thanks again for your contribution!

@ammaraziz ammaraziz changed the base branch from main to dev January 15, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant