-
Notifications
You must be signed in to change notification settings - Fork 953
Fix variable redeclarations for strict syntax compliance #9684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ewels
wants to merge
10
commits into
nf-core:master
Choose a base branch
from
ewels:fix/variable-redeclarations
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mashehu
previously requested changes
Jan 16, 2026
Remove variable redeclarations by renaming closure parameters and local variables that shadow input parameters or previously declared variables. Fixed modules: - bbmap/bbsplit: Renamed 'index' closure parameter to 'idx' in eachWithIndex - bedtools/groupby: Renamed local 'summary_col' to 'summary_col_opt' - mafft/align: Renamed stub section variables with '_stub' suffix - spaceranger/count: Renamed option variables with '_opt' suffix This addresses variable redeclaration errors flagged by nextflow lint in strict syntax mode (NXF_SYNTAX_PARSER=v2). Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Continue fixing variable redeclaration errors for strict syntax mode: - krakentools/extractkrakenreads: Use distinct meta parameter names (meta2, meta3) - mafft/align: Rename local option variables with _opt suffix - blobtk/plot: Add def keyword to script section variables - cellranger/count: Add def keyword to script section variables - diann: Add def keyword to script section variables - flash: Add def keyword to script section variables - scds: Add def keyword to script section variables In strict syntax mode, all variable declarations must use the def keyword explicitly, and variables cannot be redeclared within the same scope. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Continue fixing variable redeclarations: - peka, pureclip: Use distinct meta parameter names for multiple tuple inputs - svtyper/svtyper: Fix duplicate meta2 in inputs, rename vcf shadow variable - svtyper/svtypersso: Rename vcf and fasta shadow variables with _opt suffix - cellrangerarc/mkref: Rename reference_config to reference_config_name - eklipse: Rename ref_gb to ref_gb_path - ichorcna/createpon: Rename exons to exons_opt, add def to prefix - igvreports: Rename fasta to fasta_opt Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Complete fixing all variable redeclaration errors for strict syntax mode: - pureclip: Use distinct meta parameter name (meta3) for third input - jvarkit/sam2tsv, jvarkit/vcf2table: Rename regions_file to regions_opt - hmmer/hmmfetch: Rename index to index_opt - chewbbaca/createschema: Rename prodigal_tf and cds to *_opt - cnvnator/cnvnator: Add def to prefix in script section - crumble: Rename bedout to bedout_opt in both script and stub - gmmdemux: Rename skip and type_report to *_opt - happy/sompy: Rename bams to bams_opt - salsa2: Rename gfa and dup to *_opt - sam2lca/analyze: Rename database to database_path - segemehl/align: Rename reads to reads_opt, add def to prefix - svanalyzer/svbenchmark: Rename bed to bed_opt All 53 variable redeclaration errors have been resolved. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
363af1f to
8954f04
Compare
SPPearce
requested changes
Jan 19, 2026
Contributor
SPPearce
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why it is trying to add the def to the prefix, even when it needs to be there.
Addresses review comments from @SPPearce on PR nf-core#9684: 1. Remove 'def' from prefix variables used in output blocks: - cnvnator/cnvnator: Remove def from prefix (script & stub) - diann: Remove def from prefix (script & stub) - flash: Remove def from prefix (script & stub) - ichorcna/createpon: Remove def from prefix (script only) - segemehl/align: Remove def from prefix (script only) 2. Remove unnecessary variable declarations: - mafft/align: Remove unused stub variables (args_stub, add_stub, addfragments_stub, addfull_stub, addprofile_stub, addlong_stub) - mafft/align: Remove def from prefix (script) and prefix_stub 3. Improve code formatting: - spaceranger/count: Add backslash continuation between image option variables for better readability All changes verified with: - nextflow lint (all modules pass) - NXF_SYNTAX_PARSER=v2 nextflow inspect (all modules pass) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
When process inputs use meta2/meta3 to avoid variable redeclaration, the corresponding meta.yml files must document these renamed variables. Updated: - krakentools/extractkrakenreads: meta → meta2, meta3 - peka: meta → meta2 - pureclip: meta → meta2, meta3 - svtyper/svtyper: meta2 → meta3 (for fai input) All modules verified with: - nextflow inspect (standard parser) - NXF_SYNTAX_PARSER=v2 nextflow inspect (strict parser) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
SPPearce
reviewed
Jan 19, 2026
SPPearce
approved these changes
Jan 19, 2026
Contributor
SPPearce
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine, if the tests pass (a big if)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes variable redeclaration errors for strict syntax compliance.
Details
Changes
This PR fixes 53 strict syntax errors across 30+ modules by resolving variable redeclaration issues using multiple strategies:
index→idx)fastq→fastq_opt)meta2,meta3)defkeywords - Explicitly declared variables in script sectionsExample fix:
Why
Nextflow 25.10+ strict syntax mode enforces stricter scoping rules and prevents variable redeclarations that could lead to ambiguity or bugs. Each variable must be declared only once per scope.
Affected Modules (30+)
Including: bbmap/bbsplit, mafft/align, spaceranger/count, krakentools/kreport2krona, cnvnator,hmmer/hmmalign, jvarkit/sam2tsv, salsa2, and many others.
Testing
nextflow lintvalidationThis work was completed with AI assistance using Seqera AI.