CRAP |
Complexity |
Coverage |
Location |
5.40 |
4 |
5/9 (55.56%) |
crap/lint.service.ts
(L10 - L43)
|
public getLintFunctionForCoverageFunction({
coverageFunction,
lintReport,
}: {
coverageFunction: FunctionMapping;
lintReport: Array<FunctionComplexity | null>;
}): FunctionComplexity | null {
/*
* Try to match against an actual function (as reported by ESLint), but fall back to other types
* sometimes reported by istanbul as functions in specified order.
*/
for (const type of ["function", "enum", "class", "export"] as const) {
const matches = this.match({ coverageFunction, lintReport, type });
if (matches.length === 1) {
return matches[0];
}
if (matches.length > 1) {
this.logger.error(
`Found multiple matches for ${type} in ESLint data for coverage function '${coverageFunction.name}'.`,
{ coverageFunction, matches },
);
return null;
}
}
this.logger.error(
`Could not find matching function in ESLint data for coverage function '${coverageFunction.name}'.`,
{
location: coverageFunction.loc,
all: lintReport,
},
);
return null;
}