(a: Issue, b: Issue)
| 249 | } |
| 250 | |
| 251 | export 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 | |
| 274 | function compareSourceFilePosition( |
| 275 | a: SourceFileLocation['position'], |
nothing calls this directly
no test coverage detected