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

Function compareIssues

packages/utils/src/lib/reports/utils.ts:251–272  ·  view source on GitHub ↗
(a: Issue, b: Issue)

Source from the content-addressed store, hash-verified

249}
250
251export function compareIssues(a: Issue, b: Issue): number {
252 if (a.severity !== b.severity) {
253 return -compareIssueSeverity(a.severity, b.severity);
254 }
255 if (!a.source && b.source) {
256 return -1;
257 }
258 if (a.source && !b.source) {
259 return 1;
260 }
261 if (a.source && b.source) {
262 const aId = getSourceIdentifier(a.source);
263 const bId = getSourceIdentifier(b.source);
264 if (aId !== bId) {
265 return aId.localeCompare(bId);
266 }
267 if (isFileSource(a.source) && isFileSource(b.source)) {
268 return compareSourceFilePosition(a.source.position, b.source.position);
269 }
270 }
271 return 0;
272}
273
274function compareSourceFilePosition(
275 a: SourceFileLocation['position'],

Callers

nothing calls this directly

Calls 4

compareIssueSeverityFunction · 0.85
getSourceIdentifierFunction · 0.85
isFileSourceFunction · 0.70

Tested by

no test coverage detected