MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cmd_union

Function cmd_union

scripts/sanitizer-coverage-map.py:207–230  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

205
206
207def cmd_union(args) -> int:
208 out = os.path.abspath(args.out)
209 lanes = [f[:-5] for f in sorted(os.listdir(out)) if f.endswith(".lcov")]
210 if not lanes:
211 sys.exit(f"sanitizer-coverage-map: no <lane>.lcov under {out} (run `run` first)")
212 total: dict[tuple[str, str], int] = {}
213 for lane in lanes:
214 for key, c in read_lcov(os.path.join(out, f"{lane}.lcov")).items():
215 total[key] = max(total.get(key, 0), c)
216 never = sorted(k for k, c in total.items() if c == 0 and not k[0].startswith(("tests/", "..")))
217 with open(os.path.join(out, "never-executed.txt"), "w") as fh:
218 for src, fn in never:
219 fh.write(f"{src}\t{fn}\n")
220 by_file = defaultdict(int)
221 for src, _ in never:
222 by_file[src] += 1
223 functions = sum(1 for k in total if not k[0].startswith(("tests/", "..")))
224 print(f"lanes merged: {', '.join(lanes)}")
225 print(f"functions: {functions:,} never executed under any lane: {len(never):,} "
226 f"(vendored: {sum(1 for s, _ in never if is_vendored(s)):,})")
227 for src, n in sorted(by_file.items(), key=lambda kv: (-kv[1], kv[0]))[: args.top]:
228 print(f" {n:>6} {src}{' [vendored]' if is_vendored(src) else ''}")
229 print(f"list: {out}/never-executed.txt")
230 return 0
231
232
233def cmd_ratchet(args) -> int:

Callers

nothing calls this directly

Calls 6

read_lcovFunction · 0.85
sumFunction · 0.85
is_vendoredFunction · 0.70
getMethod · 0.65
openFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected