Skip to content

Commit 393f315

Browse files
committed
Fixed the module finding code (2nd pass)
1 parent ca5575a commit 393f315

File tree

1 file changed

+20
-9
lines changed
  • src/strict_syntax_health

1 file changed

+20
-9
lines changed

src/strict_syntax_health/cli.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -335,21 +335,32 @@ def scan_modules_meta_yml_stats() -> dict:
335335
details: list[dict] = []
336336

337337
# Scan modules — meta.yml must have both topics: and versions:
338-
# Walk the same two-level structure as discover_modules() so counts match exactly.
338+
# Walk the same single-level / two-level structure as discover_modules() so counts match exactly.
339339
modules_path = MODULES_DIR / "modules" / "sanger-tol"
340340
if modules_path.exists():
341341
for tool_dir in sorted(modules_path.iterdir()):
342342
if not tool_dir.is_dir() or tool_dir.name.startswith("."):
343343
continue
344-
for subcommand_dir in sorted(tool_dir.iterdir()):
345-
if not subcommand_dir.is_dir() or subcommand_dir.name.startswith("."):
346-
continue
347-
if not (subcommand_dir / "main.nf").exists():
348-
continue
349-
meta_yml = subcommand_dir / "meta.yml"
344+
# Single-level module: modules/sanger-tol/<name>/main.nf
345+
if (tool_dir / "main.nf").exists():
346+
component_dirs = [(tool_dir, tool_dir.name, f"{base_url_modules}/{tool_dir.name}/meta.yml")]
347+
else:
348+
component_dirs = []
349+
for subcommand_dir in sorted(tool_dir.iterdir()):
350+
if not subcommand_dir.is_dir() or subcommand_dir.name.startswith("."):
351+
continue
352+
if not (subcommand_dir / "main.nf").exists():
353+
continue
354+
component_dirs.append(
355+
(
356+
subcommand_dir,
357+
f"{tool_dir.name}_{subcommand_dir.name}",
358+
f"{base_url_modules}/{tool_dir.name}/{subcommand_dir.name}/meta.yml",
359+
)
360+
)
361+
for path, name, html_url in component_dirs:
362+
meta_yml = path / "meta.yml"
350363
total += 1
351-
name = f"{tool_dir.name}_{subcommand_dir.name}"
352-
html_url = f"{base_url_modules}/{tool_dir.name}/{subcommand_dir.name}/meta.yml"
353364

354365
_no_meta = {
355366
"name": name,

0 commit comments

Comments
 (0)