MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / cardCoverage

Function cardCoverage

libatomic/src/review/viewer.js:470–513  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

468 }
469
470 function cardCoverage() {
471 const host = el('div', 'card-coverage');
472 const table = (label, headings) => {
473 const section = el('section'); section.append(el('h3', '', label));
474 const grid = el('table'), head = el('thead'), row = el('tr'), body = el('tbody');
475 for (const heading of headings) { const cell = el('th', '', heading); cell.scope = 'col'; row.append(cell); }
476 head.append(row); grid.append(head, body); section.append(grid); host.append(section);
477 return body;
478 };
479 const auditBody = table('Audit cards — local rule coverage', ['Card', 'Coverage', 'Checks', viewComparison ? 'New / existing / resolved / other' : 'Findings']);
480 for (const card of data.audit_cards) {
481 const checks = graph.nodes.filter(node => node.kind === 'check' && node.properties.rule === card.id);
482 const completed = checks.filter(node => node.properties.status === 'completed').length;
483 const skipped = checks.filter(node => node.properties.status === 'skipped').length;
484 const errors = checks.filter(node => node.properties.status === 'error').length;
485 const status = errors ? 'Error' : completed ? (skipped ? 'Partial' : 'Checked') : skipped ? 'Skipped' : 'Not evaluated';
486 const findings = graph.findings.filter(item => item.finding.requirement_or_rule.id === card.id).length;
487 const row = el('tr'); row.dataset.cardId = card.id; row.dataset.kind = 'audit';
488 const name = el('td'); name.append(cardCallout(card.id, card.title));
489 const own=graph.findings.filter(item=>item.finding.requirement_or_rule.id===card.id);
490 const totals=viewComparison ? ['new','existing','resolved','other'].map(status=>own.filter(item=>status==='other' ? !['new','existing','resolved'].includes(item.comparison?.status) : item.comparison?.status===status).length).join(' / ') : String(findings);
491 row.append(name, el('td', '', status), el('td', '', `${completed} completed · ${skipped} skipped · ${errors} errors`), el('td', '', totals));
492 auditBody.append(row);
493 }
494 const metricBody = table('Metric cards — all recorded observations', ['Card', 'Coverage', viewSnapshot ? 'Recorded snapshot' : 'Before / after', 'Observations']);
495 for (const [id, card] of metricCards) {
496 const nodes = graph.nodes.filter(node => node.kind === 'metric' && metricId(node) === id);
497 const sides = (viewSnapshot ? ['after'] : ['before', 'after']).map(side => {
498 const measured = nodes.filter(node => node.properties.observation[side]?.status === 'measured').length;
499 const absent = nodes.filter(node => node.properties.observation[side]?.status === 'not_applicable').length;
500 return { measured, absent, unavailable: nodes.length - measured - absent };
501 });
502 const measured = sides.some(side => side.measured), unavailable = sides.some(side => side.unavailable);
503 const status = !nodes.length ? 'Not evaluated' : unavailable ? (measured ? 'Partial' : 'Unavailable') : measured ? 'Measured' : 'Not applicable';
504 const row = el('tr'); row.dataset.cardId = id; row.dataset.kind = 'metric';
505 const name = el('td'); name.append(cardCallout(id, card.title));
506 row.append(name, el('td', '', status), el('td', '', sides.map(side => `${side.measured} measured · ${side.absent} N/A · ${side.unavailable} unavailable`).join(' / ')), el('td', '', String(nodes.length)));
507 metricBody.append(row);
508 }
509 host.append(el('p', 'muted', 'Checked means the registered local rules ran, not that the code is defect-free. Unsupported and unavailable cases are never passing results. Counts cover the exact ' + (viewSnapshot ? 'recorded view snapshot.' : 'selected recorded changes.')));
510 const panel = detail(`All cards: ${data.audit_cards.length} audits · ${data.metric_cards.length} metrics`, host);
511 panel.id = 'card-coverage';
512 return panel;
513 }
514
515 function renderConformanceOverview() {
516 const host = $('conformance-overview'); host.replaceChildren(); host.className = 'overview';

Callers 1

renderAuditOverviewFunction · 0.85

Calls 7

elFunction · 0.85
tableFunction · 0.85
cardCalloutFunction · 0.85
metricIdFunction · 0.85
detailFunction · 0.85
includesMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected