MCPcopy Create free account
hub / github.com/idank/explainshell / _summarize_comparison

Function _summarize_comparison

tests/evals/render/render_eval.py:369–420  ·  view source on GitHub ↗
(
    base_dir: Path,
    current_dir: Path,
    baseline: dict[str, Any],
    current: dict[str, Any],
    suspicious: dict[str, list[str]],
    paths: list[str],
)

Source from the content-addressed store, hash-verified

367
368
369def _summarize_comparison(
370 base_dir: Path,
371 current_dir: Path,
372 baseline: dict[str, Any],
373 current: dict[str, Any],
374 suspicious: dict[str, list[str]],
375 paths: list[str],
376) -> str:
377 base_pages = _page_map(baseline)
378 current_pages = _page_map(current)
379 lines: list[str] = [
380 "# Markdown render comparison",
381 "",
382 f"Baseline: `{base_dir}` (`{baseline['label']}`)",
383 f"Current: `{current_dir}` (`{current['label']}`)",
384 "",
385 "## Summary",
386 "",
387 f"- baseline pages: {len(base_pages)}",
388 f"- current pages: {len(current_pages)}",
389 f"- baseline failures: {baseline['failure_count']}",
390 f"- current failures: {current['failure_count']}",
391 "",
392 "## Suspicious structural changes",
393 "",
394 ]
395
396 if suspicious:
397 for path, reasons in suspicious.items():
398 lines.append(f"### `{path}`")
399 lines.append("")
400 for reason in reasons:
401 lines.append(f"- {reason}")
402 lines.append("")
403 else:
404 lines.append("No suspicious structural changes detected.")
405 lines.append("")
406
407 lines.extend(["## Metric deltas", ""])
408 for path in paths:
409 old = base_pages.get(path)
410 new = current_pages.get(path)
411 if old is None or new is None:
412 continue
413 changed = _changed_metric_lines(old, new)
414 if changed:
415 lines.append(f"### `{path}`")
416 lines.append("")
417 lines.extend(changed)
418 lines.append("")
419
420 return "\n".join(lines)
421
422
423def _comparison_data(

Callers 2

compare_runsFunction · 0.85
diff_reportFunction · 0.85

Calls 2

_page_mapFunction · 0.90
_changed_metric_linesFunction · 0.85

Tested by

no test coverage detected