coverage-diff-reporter
БесплатноБез исполняемых скриптовНе проверенUse when a pull request needs readable coverage feedback rather than one total. Compares current and baseline coverage (LCOV, Cobertura or JSON) and reports…
от testland★ 18 звёзд на GitHubОб этом скилле
coverage-diff-reporter
Overview
An aggregate coverage number hides where coverage moved: -0.4pp overall
can be one file at -12pp. This skill turns two parsed coverage runs
(PR head and merge-target baseline) into a per-file delta report and a
one-line PR summary. It does not decide pass/fail; the gate in
lcov-analysis does that. This skill makes the diff legible.
Inputs: the current run's LCOV or Cobertura file and the baseline's.
Output: diff.md (full report) posted as one sticky PR comment.
Step 1 - Parse both runs with the same parser
Use the parser from lcov-analysis (its "Parse" section; Cobertura
parser in its references/cobertura.md), saved in your repo as
scripts/parse_lcov.py or scripts/parse_cobertura.py. Each emits a
list of per-file dicts with path, lf, lh, brf, brh - the LCOV
LF/LH (lines found / hit) and BRF/BRH (branches found / hit)
counters ([lcov][lcov]).
| Existing reporter | Use |
|---|---|
LCOV .info |
lcov-analysis LCOV parser |
| Cobertura XML | lcov-analysis Cobertura parser (references/cobertura.md) |
| Jest / V8 coverage | Emit LCOV first (jest --coverageReporters=lcov) |
| JaCoCo XML | jacoco-analysis, or convert to Cobertura |
| coverage.py | coverage xml (Cobertura) or coverage lcov (LCOV) |
Run the same parser on both files, so both sides use identical path and counting rules.
Step 2 - Get the baseline
Pattern A (default) - cached artifact. The merge target's last
green CI run uploads its coverage file; the PR job downloads it with
[dawidd6/action-download-artifact][dl] (workflow, branch and
name select the run and artifact; if_no_artifact_found defaults to
fail):
- name: Restore baseline
uses: dawidd6/action-download-artifact@v3
with:
workflow: coverage.yml
branch: main
name: coverage-baseline
path: baseline/
if_no_artifact_found: warn
- name: Parse both runs
run: |
python scripts/parse_lcov.py coverage/lcov.info > current.json
python scripts/parse_lcov.py baseline/lcov.info > baseline.json
Pattern B (fallback) - recompute. Check out the merge target, run the tests with coverage, save the file, then check out the PR head and run again. About twice the runtime; use it when the artifact has expired or the baseline run is not deterministic.
Step 3 - Check the inputs before diffing
Stop and fix the inputs if any check fails; a diff of bad inputs is worse than no report.
- Both JSON files exist and hold at least one file entry. If the baseline is missing (Pattern A warned), post "no baseline - report skipped" instead of a diff that shows every file as new.
- Paths use the same root on both sides. If more than half of the current files have no baseline match, the paths differ (absolute vs repo-relative, different checkout dirs): strip the common prefix and re-run.
- Record the baseline commit and its age; print both in the report header (Step 6).
Step 4 - Compute the per-file delta
# scripts/coverage_diff.py
def pct(hit, found):
return round(100.0 * hit / found, 1) if found else None
def delta(now, then):
return None if now is None or then is None else round(now - then, 1)
def compute_diff(current, baseline):
base_idx = {f['path']: f for f in baseline}
cur_paths = {f['path'] for f in current}
rows = []
for f in current:
b = base_idx.get(f['path'])
line_now, branch_now = pct(f['lh'], f['lf']), pct(f['brh'], f['brf'])
line_then = pct(b['lh'], b['lf']) if b else None
branch_then = pct(b['brh'], b['brf']) if b else None
rows.append({'path': f['path'], 'is_new': b is None,
'line_now': line_now, 'line_delta': delta(line_now, line_then),
'branch_now': branch_now, 'branch_delta': delta(branch_now, branch_then)})
for path, b in base_idx.items(): # deleted files
if path not in cur_paths:
rows.append({'path': path, 'is_deleted': True,
'line_then': pct(b['lh'], b['lf'])})
return rows
Step 5 - Classify and sort
NEW_FILE_MIN, REGRESSION_PP, NOISE_PP = 80, -5, 0.5 # tune per repo
def classify(row):
if row.get('is_deleted'):
return 'deleted'
if row['is_new']:
return 'new_below_threshold' if (row['line_now'] or 0) < NEW_FILE_MIN else 'new_ok'
d = row['line_delta']
if d is None or abs(d) < NOISE_PP:
return 'unchanged'
return 'regressed' if d <= REGRESSION_PP else 'declined' if d < 0 else 'improved'
Sort regressions by line_delta ascending (largest drop first) and put
new below-threshold files at the top. Leave unchanged rows out of the
tables; report
Установить coverage-diff-reporter в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл coverage-diff-reporter?
Use when a pull request needs readable coverage feedback rather than one total. Compares current and baseline coverage (LCOV, Cobertura or JSON) and reports per-file line and branch deltas, new files and hidden drops, with a one-line summary for the PR comment.
Как установить скилл coverage-diff-reporter?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл coverage-diff-reporter запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic