Nextflow Extension Code Formatting breaking my code?

After updating the nextflow extension, I think some of the automatic formatting may be breaking my code.

Here is a snippet of code before formatting with the new formatter:

After hitting Format, this is what I get (notice the extra = mark added)

Upon inspection I’m now getting an error that this if statement is incorrect

And now upon running this nextflow pipeline I get a compilation error.

N E X T F L O W   ~  version 24.04.4

Launching `main.nf` [small_turing] DSL2 - revision: 45f0636c99

ERROR ~ Module compilation error
- file : /ibex/user/pampum/2024-10-28_test-modifying-sanger-tol-readmapping-pipeline-to-add-depth-calculations/readmapping_fork_with-samtools-depth/./workflows/../subworkflows/local/convert_stats.nf
- cause: Unexpected input: '{' @ line 16, column 24.
   workflow CONVERT_STATS {
                          ^

1 error

NOTE: If this is the beginning of a process or workflow, there may be a syntax error in the body, such as a missing or extra comma, for which a more specific error message could not be produced.

 -- Check script './workflows/readmapping.nf' at line: 26 or see '.nextflow.log' file for more details

And it ran perfectly fine before I formatted this document. Does anyone know if there are some bugs with the formatter currently?

Hi Mark, thanks for reporting. Looks like a bug in the formatter, I didn’t account for declarations with no initial value. This will be fixed in the next patch release.

1 Like