One sentence per category, counting the checklist and naming the facts.
(category: ChecklistCategory, items: ChecklistItem[], ir: SemanticIR)
| 192 | |
| 193 | /** One sentence per category, counting the checklist and naming the facts. */ |
| 194 | function labelFor(category: ChecklistCategory, items: ChecklistItem[], ir: SemanticIR): string { |
| 195 | switch (category) { |
| 196 | case 'core-logic': |
| 197 | return miniReadCalls(items.length); |
| 198 | case 'error-handling': |
| 199 | return miniErrorPath(distinct(ir.throws.value.map(entry => entry.type))); |
| 200 | case 'callers': |
| 201 | return miniCallers(items.length); |
| 202 | case 'config': |
| 203 | return miniConfig(distinct(ir.reads.value.map(entry => entry.name))); |
| 204 | case 'inputs': |
| 205 | return miniShape(distinct((ir.typeRefs?.value ?? []).map(entry => entry.name))); |
| 206 | case 'implementations': |
| 207 | return miniConstructions(items.length); |
| 208 | case 'tests': |
| 209 | // The generator emits exactly one item for the empty case, and it is |
| 210 | // a finding rather than a task, so it keeps its own wording. |
| 211 | return ir.tests.value.length === 0 ? MINI_TESTS_NONE : miniTests(ir.tests.value.length); |
| 212 | default: |
| 213 | return items[0]?.label ?? ''; |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | /** |
| 218 | * The strip for one symbol. |
no test coverage detected