MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / iter_markdown_files

Function iter_markdown_files

scripts/documentation-verify.py:699–719  ·  view source on GitHub ↗

Yield every first-party `.md` file under `targets`, deduplicated and sorted. Vendored `lib/` trees, build output, and `LICENSE*.md` are skipped (see `_is_skipped`) even when a target points straight at them.

(targets: list[Path])

Source from the content-addressed store, hash-verified

697
698
699def iter_markdown_files(targets: list[Path]) -> Iterable[Path]:
700 """Yield every first-party `.md` file under `targets`, deduplicated and
701 sorted. Vendored `lib/` trees, build output, and `LICENSE*.md` are
702 skipped (see `_is_skipped`) even when a target points straight at them."""
703 seen: set[Path] = set()
704 for t in targets:
705 if t.is_file():
706 if t.suffix.lower() == ".md" and not _is_skipped(t):
707 seen.add(t.resolve())
708 elif t.is_dir():
709 for root, _, files in os.walk(t):
710 root_path = Path(root)
711 if any(p in _SKIP_DIRS for p in root_path.parts):
712 continue
713 for name in files:
714 if not name.lower().endswith(".md"):
715 continue
716 p = root_path / name
717 if not _is_skipped(p):
718 seen.add(p.resolve())
719 return sorted(seen)
720
721
722# ---------------------------------------------------------------------------

Callers 1

mainFunction · 0.85

Calls 4

_is_skippedFunction · 0.85
setFunction · 0.50
addMethod · 0.45
resolveMethod · 0.45

Tested by

no test coverage detected