Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

### Linting

- fix test for linting for version.yml ([#3947](https://github.com/nf-core/tools/pull/3947))

### Modules

### Subworkflows
Expand Down
2 changes: 1 addition & 1 deletion nf_core/subworkflows/lint/main_nf.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def check_main_section(self, lines, included_components):
(
"main_nf",
"main_nf_include_versions",
f"Included component '{component}' versions are not added in main.nf Can be ignored if the module is using topic channels",
f"Included component '{component}' versions are not added in main.nf. Can be ignored if the module is using topic channels",
self.main_nf,
)
)
Expand Down
3 changes: 2 additions & 1 deletion tests/modules/lint/test_main_nf.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ def test_main_nf_lint_with_alternative_registry(self):
def test_topics_and_emits_version_check(self):
"""Test that main_nf version emit and topics check works correctly"""

self.mods_install.install("bioawk")
# Lint a module known to have versions YAML in main.nf (for now)
module_lint = nf_core.modules.lint.ModuleLint(directory=self.pipeline_dir)
module_lint.lint(print_results=False, module="samtools/sort")
module_lint.lint(print_results=False, module="bioawk")
assert len(module_lint.failed) == 0, f"Linting failed with {[x.__dict__ for x in module_lint.failed]}"
assert len(module_lint.warned) == 2, (
f"Linting warned with {[x.__dict__ for x in module_lint.warned]}, expected 2 warnings"
Expand Down
30 changes: 21 additions & 9 deletions tests/subworkflows/test_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,19 +228,19 @@ def test_subworkflows_lint_include_multiple_alias(self):
subworkflow_lint.lint(print_results=False, subworkflow="bam_stats_samtools")
assert len(subworkflow_lint.failed) >= 0, f"Linting failed with {[x.__dict__ for x in subworkflow_lint.failed]}"
assert len(subworkflow_lint.passed) > 0
assert len(subworkflow_lint.warned) == 2
assert any(
[
x.message == "Included component 'SAMTOOLS_STATS_1' versions are added in main.nf"
for x in subworkflow_lint.passed
]
)
assert len(subworkflow_lint.warned) == 3
assert any(
[x.message == "Included component 'SAMTOOLS_STATS_1' used in main.nf" for x in subworkflow_lint.passed]
)
assert any(
[x.message == "Included component 'SAMTOOLS_STATS_2' not used in main.nf" for x in subworkflow_lint.warned]
)
assert any(
[
x.message.endswith("Can be ignored if the module is using topic channels")
for x in subworkflow_lint.warned
]
)

# cleanup
self.subworkflow_remove.remove("bam_stats_samtools", force=True)
Expand Down Expand Up @@ -469,7 +469,13 @@ def test_lint_clean_patch(self):

assert len(subworkflow_lint.failed) == 0, f"Linting failed with {[x.__dict__ for x in subworkflow_lint.failed]}"
assert len(subworkflow_lint.passed) > 0
assert len(subworkflow_lint.warned) == 0, f"Linting warned with {[x.__dict__ for x in subworkflow_lint.warned]}"
assert len(subworkflow_lint.warned) == 1, f"Linting warned with {[x.__dict__ for x in subworkflow_lint.warned]}"
assert any(
[
x.message.endswith("Can be ignored if the module is using topic channels")
for x in subworkflow_lint.warned
]
)

def test_lint_broken_patch(self):
"""Test linting a patched subworkflow when the patch is broken"""
Expand All @@ -487,4 +493,10 @@ def test_lint_broken_patch(self):
errors = [x.message for x in subworkflow_lint.failed]
assert "Subworkflow patch cannot be cleanly applied" in errors
assert len(subworkflow_lint.passed) > 0
assert len(subworkflow_lint.warned) == 0, f"Linting warned with {[x.__dict__ for x in subworkflow_lint.warned]}"
assert len(subworkflow_lint.warned) == 1, f"Linting warned with {[x.__dict__ for x in subworkflow_lint.warned]}"
assert any(
[
x.message.endswith("Can be ignored if the module is using topic channels")
for x in subworkflow_lint.warned
]
)
Loading