Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I can help add some context of why this PR is useful. In Basically the message would say that almost all components of a subworkflow, e.g. The linting would break after finding the word 'emit' (which was written as a comment in that subworkflow). This PR fixes that issue :) |
mashehu
left a comment
There was a problem hiding this comment.
Nice, thanks for the contribution.
Do you have time to also add test case to tests/modules/lint/test_main_nf.py where the old linting failed and your solution works? I can have a look otherwise
Thanks @mashehu! |
| assert len(subworkflow_lint.warned) >= 0 | ||
|
|
||
| def test_skip_keyword_in_comment(self): | ||
| """Test linting a subworkflow where a comment contains a keyword (workflow, subworkflow, take, main, emit)""" |
There was a problem hiding this comment.
I think we recently decided against allowing multiple workflows in one subworkflow https://nfcore.slack.com/archives/C043UU89KKQ/p1742461607278339
There was a problem hiding this comment.
The utils_nfcore-pipeline_pipeline subworkflow, which is currently part of the template, contains multiple workflow definitions:
https://github.com/nf-core/tools/blob/dev/nf_core/pipeline-template/subworkflows/local/utils_nfcore_pipeline_pipeline/main.nf
This makes the linter raise false-positive "unused import" warnings
mirpedrol
left a comment
There was a problem hiding this comment.
Hi!
As @mashehu mentioned, we agreed that one subworkflow would have only one workflow. I think this should be the standard, and we should update the utils subworkflow in the template instead.
However, taking care of comments containing the word "emit" is a good fix, I would instead skip all comments from the parsing, so lines that start with //.
Hi @mirpedrol, thanks for the review! As per skipping all comments from the parsing, that's kind of how it works. The problem was that previously, the checking of whether the line is a comment or not, happened after searching for the keywords (emit, take, etc.) and switching the section. After this fix, the check will happen before, so it will not switch sections based on commented lines. |
Co-authored-by: nf-core-bot <[email protected]> Co-authored-by: Matthias Hörtenhuber <[email protected]>
Co-authored-by: nf-core-bot <[email protected]> Co-authored-by: Matthias Hörtenhuber <[email protected]>
Co-authored-by: nf-core-bot <[email protected]> Co-authored-by: Matthias Hörtenhuber <[email protected]>
Co-authored-by: nf-core-bot <[email protected]> Co-authored-by: Matthias Hörtenhuber <[email protected]>
Co-authored-by: nf-core-bot <[email protected]> Co-authored-by: Matthias Hörtenhuber <[email protected]>
PR checklist
CHANGELOG.mdis updateddocsis updatedFixed
Both these bugs produce false positive warnings like "Included component not used in main.nf" because the linter is not able to properly capture the whole main section.