| 181 | * factory is the point of the factory. |
| 182 | */ |
| 183 | export function evaluateRisks( |
| 184 | symbol: SymbolRef, |
| 185 | callers: Fact<CallerRef[]>, |
| 186 | tests: Fact<TestRef[]> |
| 187 | ): Risk[] { |
| 188 | const risks: Risk[] = []; |
| 189 | const isHub = callers.value.length >= UNTESTED_HUB_CALLERS; |
| 190 | const untested = tests.value.length === 0 && tests.state === 'inferred'; |
| 191 | if (isHub && untested) { |
| 192 | risks.push({ |
| 193 | id: RISK_UNTESTED_HUB, |
| 194 | severity: 'medium', |
| 195 | kind: RISK_UNTESTED_HUB, |
| 196 | message: `${symbol.name} is called from ${countOf(callers.value.length, 'place', 'places')}` |
| 197 | + ' and no test caller was found, so a change here is unverified everywhere it is used.' |
| 198 | }); |
| 199 | } |
| 200 | return risks; |
| 201 | } |
| 202 | |
| 203 | // --------------------------------------------------------------------------- |
| 204 | |