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

Function selection

libatomic/src/review/viewer.js:324–339  ·  view source on GitHub ↗
(region, pass)

Source from the content-addressed store, hash-verified

322 }
323
324 function selection(region, pass) {
325 const host = el('div');
326 host.append(el('h2', 'source-path', region.path), el('p', 'region-meta', `${location(region)} · ${regionName(region)} · ${viewComparison ? viewComparison.from.view+' → '+viewComparison.to.view : viewSnapshot ? 'view ' + viewSnapshot.view : 'change ' + region.change.slice(0, 12)}`));
327 const relevant = regionFindings(region).filter(finding => inPass(finding, pass) && (pass !== 'slop' || lifecycleMatches(finding)));
328 for (const finding of relevant) host.append(findingBlock(finding.number));
329 if (pass === 'risk') host.append(impactEvidence(region));
330 const measurements = metricTable(region);
331 const metricCount = region.metrics.length || region.context_metrics.length;
332 if (metricCount) {
333 if (pass === 'slop' && state.filter !== 'concerns') host.append(measurements);
334 else host.append(detail(`${metricCount} measurements & metric cards`, measurements));
335 }
336 host.append(sourceViewer(region));
337 if (relevant.length) showCard(relevant[0].finding.requirement_or_rule.id);
338 return host;
339 }
340
341 function lifecycleMatches(item) {
342 if (!viewComparison || !['new','existing','resolved','uncertain'].includes(state.filter)) return true;

Callers 2

renderSlopFunction · 0.85
renderRiskFunction · 0.85

Calls 13

elFunction · 0.85
regionNameFunction · 0.85
regionFindingsFunction · 0.85
inPassFunction · 0.85
lifecycleMatchesFunction · 0.85
findingBlockFunction · 0.85
impactEvidenceFunction · 0.85
metricTableFunction · 0.85
detailFunction · 0.85
sourceViewerFunction · 0.85
showCardFunction · 0.85
locationFunction · 0.70

Tested by

no test coverage detected