(
details: ImportDetailsGraph | null,
importer: string,
imported: string
)
| 401 | type ImpactCandidate = { file: string; line?: number; hop: 1 | 2 }; |
| 402 | |
| 403 | function findImportDetail( |
| 404 | details: ImportDetailsGraph | null, |
| 405 | importer: string, |
| 406 | imported: string |
| 407 | ): ImportEdgeDetail | null { |
| 408 | if (!details) return null; |
| 409 | const edges = details[importer]; |
| 410 | if (!edges) return null; |
| 411 | if (edges[imported]) return edges[imported]; |
| 412 | |
| 413 | let bestKey: string | null = null; |
| 414 | for (const depKey of Object.keys(edges)) { |
| 415 | if (!pathsMatch(depKey, imported)) continue; |
| 416 | if (!bestKey || depKey.length > bestKey.length) { |
| 417 | bestKey = depKey; |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | return bestKey ? edges[bestKey] : null; |
| 422 | } |
| 423 | |
| 424 | // Impact breadth estimate from the import graph (used for risk assessment). |
| 425 | // 2-hop: direct importers (hop 1) + importers of importers (hop 2). |
no test coverage detected