Closed LouisLeNezet closed 3 weeks ago
Thanks Louis for all of the interesting edge cases. In general I will refer you to our new docs which explain the strict syntax that is enforced by the language server (and eventually Nextflow itself) and some common patterns that need to be migrated
Error with iterator
The issue is the nb_batch++
. Prefix/postfix increment isn't supported in the strict syntax, instead you'll need to increment in a separate assignment:
.collect { nb_batch += 1; [[ id: "all", batch: nb_batch ], it] }
Definition in script use in output closure
Wow, I had no idea this worked. However I'm going to say this is an anti-pattern and instead you should declare the variable without def
so that it can be used in the output block without a closure:
output:
tuple val(meta), path("*.txt") , emit: plots , optional: generate_input
script:
generate_input = task.ext.args.contains( "--generateInputOnly TRUE" )
This is also a hack but it seems to be more common and it's easier to support in the language server. In the future I aim to make it work without either hack
Assertion with comma
Groovy allows a colon or comma here, I decided it would be better to support only one for consistency and colon seems to be the more common usage by far. Sorry :/
Math plugin in string closure
The issue is actually the static cast (int)
. Groovy supports both (int) x
and x as int
, again I opted for only one, and the latter is much simpler to implement.
And small warning when in a closure one of the argument is not used
This warning will be more clear in 1.0.1, you can prefix the parameter name with _
to suppress the warning
Thanks a lot for all the explanations. This plugin will be really usefull for the whole community !
Hi,
Here a few example of error given by the linting extension that might not be errors:
Error with iterator
Definition in script use in output closure
Assertion with comma
Math plugin in string closure:
And small warning when in a closure one of the argument is not used: