-
Notifications
You must be signed in to change notification settings - Fork 780
Open
Description
Bug report
Expected behavior and actual behavior
nextflow lint --format should preserve the semantics of multiline method chains. Instead, it reformats closures containing map merge expressions (+) across multiple lines in a way that breaks subsequent parsing, producing an Unexpected input: '+' error on the next lint run. The bug only occurs when the method chain is piped to another process via |.
Steps to reproduce the problem
Save the following as test.nf:
workflow {
channel_A = channel.fromList([[[var_a: 1], 2], [[var_a: 3], 4]])
some_previous_chaining = channel.value(1)
// This line:
channel_A
.combine(some_previous_chaining)
.map { meta, b, _c -> [meta + [var_b: b]] }
| some_process
// Gets reformatted to:
// channel_A.combine(some_previous_chaining).map { meta, b, _c -> [meta
// + [var_b: b]] }
// | some_process
// ...which causes "Unexpected input: '+'" on the next lint run.
// No bug when NOT piping to another process:
channel_A
.combine(some_previous_chaining)
.map { meta, b, _c -> [meta + [var_b: b]] }
.set { some_channel }
some_process(some_channel)
}
process some_process {
input:
val(meta)
script:
"""
echo ${meta}
"""
}Run twice:
nextflow lint -format test.nfProgram output
> nextflow lint -format test.nf
Nextflow linting complete!
✅ 1 file had no errors (1 formatted)
> nextflow lint -format test.nf
Error test.nf:7:9: Unexpected input: '+'
│ 7 | + [var_b: b]] }
╰ | ^
Error test.nf:7:9: Unexpected input: '+'
│ 7 | + [var_b: b]] }
╰ | ^
Nextflow linting complete!
❌ 1 file had 2 errors
Environment
- Nextflow version: 25.10.4.11173
- Java version: openjdk version "11.0.30" 2026-01-20
- Operating system: Windows (WSL2)
- Zsh version: 5.8.1 (x86_64-ubuntu-linux-gnu)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels