Hi ! I've fixed the issue #3479 for import across ...
# tools
l
Hi ! I've fixed the issue #3479 for import across multiple workflow, but I'm not sure that it is the right way to go. Could I have a review ? https://github.com/nf-core/tools/pull/3486
homer disappear 1
n
I admit I do not really understand what
# Keep track of open and close brackets
section is doing, shouldnt the last step happen outside of the loop?
currently it is basically
if "{" in line and "}" in line: state = "subworkflow"
?
Ah, ok, no it is not, i see, it is counting the "{" and "}",
l
Yeah the aim is to know when we are inside a workflow scope or outside.
The biggest issue is that multiple workflow in one
main.nf
would not be checked correctly for input and output for the moment. I would be for banning this possibility to simplify the issue.
n
I admit I am not really sure I understand what you are trying to do, so my comment above was probably not helpful
l
The issue is a bit more large than just the correct detection of the workflow scope in all
main.nf
files. The problem is that when multiple process or workflow are present in a single
main.nf
, the linting is aggregating all of them or checking only the first one. The best would be to split them, and separatly lint them but this might need a huge refactoring. The simplest would be just to ban the use of multiple process/workflow per file, which from my point of view is better as it would align with a better organisation and documentation.
n
I thought 1 per file was already the case for processes in nfcore?
l
Maybe for processes but not for subworkflow and workflow apparently. Even the TEMPLATE have some multiple workflow per file.
n
So, in any case, you are using number of open and close brackets seen so far to track if you are inside (open > close) or outside (open == close) a workflow.
wouldnt this :
if re.search(r"^\s*workflow\s*\w*\s*{", line) and state == "subworkflow":
fail when state was set to something else before, since it would not correctly reset to subworkflow since there is 1 more open than close bracket so far?
Copy code
workflow1 {
take
main
emit
}

workflow2 {
take
main
emit
}
and the state is emit from workflow1?
l
Yeah maybe the last
}
would be wrongly taken out of the workflow. But I don't think that will be a problem...
👍 1
n
and also (not sure if this is supposed to be supported)
Copy code
workflow { // subworkflow
// subworkflow
subworkflow1 { // subworkflow
take // take
main // main
emit // emit
} // emit (1more open than close)
// emit
subworkflow2 { //emit 
take // take
main // main
emit // emit
} // emit
} // subworkflow
l
I don't think we should support that 😅
👍 1