Skip to content

Commit

Permalink
Merge pull request #3156 from nvnieuwk/fix/tool-subtool-same-name
Browse files Browse the repository at this point in the history
Fix issue where tool and subtool have the same name
  • Loading branch information
nvnieuwk authored Sep 5, 2024
2 parents 25224a0 + b6e19d8 commit 308baef
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
13 changes: 8 additions & 5 deletions nf_core/components/nfcore_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@ def __init__(
self.process_name = ""
self.environment_yml: Optional[Path] = Path(self.component_dir, "environment.yml")

name_index = (
len(self.component_dir.parts)
- 1
- self.component_dir.parts[::-1].index(self.component_name.split("/")[0])
)
component_list = self.component_name.split("/")

name_index = len(self.component_dir.parts) - 1 - self.component_dir.parts[::-1].index(component_list[0])
if len(component_list) != 1 and component_list[0] == component_list[1]:
# Handle cases where the subtool has the same name as the tool
name_index -= 1

repo_dir = self.component_dir.parts[:name_index][-1]

self.org = repo_dir
self.nftest_testdir = Path(self.component_dir, "tests")
self.nftest_main_nf = Path(self.nftest_testdir, "main.nf.test")
Expand Down
9 changes: 9 additions & 0 deletions tests/modules/test_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,15 @@ def test_modules_lint_trimgalore(self):
assert len(module_lint.passed) > 0
assert len(module_lint.warned) >= 0

def test_modules_lint_tabix_tabix(self):
"""Test linting the tabix/tabix module"""
self.mods_install.install("tabix/tabix")
module_lint = nf_core.modules.lint.ModuleLint(directory=self.pipeline_dir)
module_lint.lint(print_results=False, module="tabix/tabix")
assert len(module_lint.failed) == 0, f"Linting failed with {[x.__dict__ for x in module_lint.failed]}"
assert len(module_lint.passed) > 0
assert len(module_lint.warned) >= 0

def test_modules_lint_empty(self):
"""Test linting a pipeline with no modules installed"""
self.mods_remove.remove("fastqc", force=True)
Expand Down

0 comments on commit 308baef

Please sign in to comment.