MCPcopy Create free account
hub / github.com/code-pushup/cli / calculateGroupImpact

Function calculateGroupImpact

packages/ci/src/lib/issues.ts:183–198  ·  view source on GitHub ↗
(
  ref: CategoryRef,
  audit: Audit,
  report: Report,
)

Source from the content-addressed store, hash-verified

181}
182
183export 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}

Callers 2

getAuditImpactValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected