(inputs: NarrativeInputs)
| 601 | * at, and they say what. |
| 602 | */ |
| 603 | export function buildNarrative(inputs: NarrativeInputs): ImpactNarrative { |
| 604 | const evidence: ImpactEvidence[] = []; |
| 605 | const changedFiles = inputs.change?.changedFiles.length ?? 0; |
| 606 | const reported = inputs.change?.symbols.length ?? 0; |
| 607 | |
| 608 | evidence.push({ |
| 609 | claim: impactChangedSentence(changedFiles, inputs.declared), |
| 610 | source: 'detect_changes', |
| 611 | value: `${countOf(changedFiles, 'changed file', 'changed files')}, ` |
| 612 | + `${countOf(reported, 'symbol', 'symbols')} reported`, |
| 613 | }); |
| 614 | const seeds = inputs.change?.seedSymbols; |
| 615 | if (seeds !== undefined && seeds !== inputs.declared) { |
| 616 | evidence.push({ |
| 617 | claim: impactSeedSentence(seeds, inputs.declared), |
| 618 | source: 'detect_changes', |
| 619 | value: `${countOf(seeds, 'seed declaration', 'seed declarations')} reported, ` |
| 620 | + `${countOf(inputs.declared, 'symbol', 'symbols')} listed`, |
| 621 | }); |
| 622 | } |
| 623 | evidence.push({ |
| 624 | claim: impactDownstreamSentence(inputs.callers, inputs.walkedDistance), |
| 625 | source: 'detect_changes', |
| 626 | value: `${countOf(inputs.callers, 'caller', 'callers')} over ` |
| 627 | + `${countOf(inputs.walkedDistance, 'walked step', 'walked steps')}`, |
| 628 | }); |
| 629 | evidence.push({ |
| 630 | claim: impactEndpointSentence(inputs.endpoints.map((endpoint) => endpointLabel(endpoint))), |
| 631 | source: 'architecture', |
| 632 | value: `${countOf(inputs.architecture?.routes.length ?? 0, 'route', 'routes')} recovered, ` |
| 633 | + `${inputs.endpoints.length} reached`, |
| 634 | }); |
| 635 | evidence.push({ |
| 636 | claim: impactTestsSentence(inputs.tests.covering.length, inputs.tests.missing.length), |
| 637 | source: 'facts', |
| 638 | value: `${countOf(inputs.tests.checked, 'symbol', 'symbols')} checked for test callers`, |
| 639 | }); |
| 640 | if (inputs.completeness.unmeasured > 0) { |
| 641 | evidence.push({ |
| 642 | claim: impactUnmeasuredSentence(inputs.completeness.unmeasured), |
| 643 | source: 'facts', |
| 644 | value: `${inputs.completeness.measured} of ${inputs.completeness.total} symbols carry a complexity reading`, |
| 645 | }); |
| 646 | } |
| 647 | if (inputs.tests.cappedAt !== undefined) { |
| 648 | evidence.push({ |
| 649 | claim: impactTestLookupCapped(inputs.tests.cappedAt), |
| 650 | source: 'facts', |
| 651 | value: `lookup capped at ${inputs.tests.cappedAt} symbols`, |
| 652 | }); |
| 653 | } |
| 654 | if (inputs.change?.truncated === true) { |
| 655 | evidence.push({ |
| 656 | claim: IMPACT_WALK_TRUNCATED, |
| 657 | source: 'detect_changes', |
| 658 | value: `walk stopped after ${inputs.walkedDistance} steps`, |
| 659 | }); |
| 660 | } |
no test coverage detected