( ref: CategoryRef, audit: Audit, report: Report, )
| 181 | } |
| 182 | |
| 183 | export function calculateGroupImpact( |
| 184 | ref: CategoryRef, |
| 185 | audit: Audit, |
| 186 | report: Report, |
| 187 | ): number { |
| 188 | const group = report.plugins |
| 189 | .find(({ slug }) => slug === ref.plugin) |
| 190 | ?.groups?.find(({ slug }) => slug === ref.slug); |
| 191 | if (!group?.refs.length) { |
| 192 | return 0; |
| 193 | } |
| 194 | const groupRatio = |
| 195 | (group.refs.find(({ slug }) => slug === audit.slug)?.weight ?? 0) / |
| 196 | group.refs.reduce((acc, { weight }) => acc + weight, 0); |
| 197 | return ref.weight * groupRatio; |
| 198 | } |
no outgoing calls
no test coverage detected