Skip to content
Open
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
3 changes: 3 additions & 0 deletions nf_core/components/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,12 @@ def generate_component_info_help(self):
# Inputs
if self.meta.get("input"):
inputs_table = self.generate_params_table("Inputs")
log.debug(f"Input channels: {self.meta['input']}")
for i, input_channel in enumerate(self.meta["input"]):
inputs_table.add_row(f"[italic]input[{i}][/]", "", "")
if self.component_type == "modules":
if not isinstance(input_channel, list):
input_channel = [input_channel]
for element in input_channel:
for key, info in element.items():
inputs_table.add_row(
Expand Down
29 changes: 29 additions & 0 deletions tests/modules/test_info.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from pathlib import Path

import yaml
from rich.console import Console

import nf_core.modules.info
Expand Down Expand Up @@ -60,3 +63,29 @@ def test_modules_info_in_modules_repo(self):
assert "Module: fastqc" in output
assert "Inputs" in output
assert "Outputs" in output

def test_modules_info_mixed_input_type(self):
"""Test getting info about a module with mixed input types (list and dict)"""
self.mods_install.install("fastqc")
meta_path = Path(self.pipeline_dir, "modules", "nf-core", "fastqc", "meta.yml")

# Load existing meta.yml
with open(meta_path) as f:
meta = yaml.safe_load(f)

# Append a dictionary-style input (the cause of the bug)
meta["input"].append({"index_format": {"type": "string", "description": "Index format"}})

# Write modified meta.yml back
with open(meta_path, "w") as f:
yaml.dump(meta, f)

mods_info = nf_core.modules.info.ModuleInfo(self.pipeline_dir, "fastqc")
mods_info_output = mods_info.get_component_info()
console = Console(record=True)
console.print(mods_info_output)
output = console.export_text()

assert "Module: fastqc" in output
assert "index_format" in output
assert "(string)" in output
Loading