()
| 115 | |
| 116 | |
| 117 | def scan() -> dict[str, list[tuple[int, str]]]: |
| 118 | hits: dict[str, list[tuple[int, str]]] = {} |
| 119 | for root in SCAN_ROOTS: |
| 120 | base = ROOT / root |
| 121 | if not base.exists(): |
| 122 | continue |
| 123 | for path in sorted(base.rglob("*")): |
| 124 | if path.suffix not in (".c", ".h") or not path.is_file(): |
| 125 | continue |
| 126 | rel = path.relative_to(ROOT).as_posix() |
| 127 | if is_exempt(rel): |
| 128 | continue |
| 129 | text = strip_comments_and_strings(path.read_text(encoding="utf-8", errors="replace")) |
| 130 | for lineno, line in enumerate(text.splitlines(), 1): |
| 131 | for m in RAW.finditer(line): |
| 132 | hits.setdefault(rel, []).append((lineno, m.group(1))) |
| 133 | return hits |
| 134 | |
| 135 | |
| 136 | def read_baseline() -> dict[str, int]: |
no test coverage detected