Skip to content

Commit

Permalink
fix messing the order of messages
Browse files Browse the repository at this point in the history
when posting to a git platform.
The order of messages without file/line data were being reversed, but **only** when posting to a git platform e.g. github.
  • Loading branch information
falkenhawk committed Nov 2, 2022
1 parent 0c8804f commit 7b60e62
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions source/dsl/DangerResults.ts
Expand Up @@ -190,6 +190,9 @@ export function sortInlineResults(inlineResults: DangerInlineResults[]): DangerI

export function sortResults(results: DangerResults): DangerResults {
const sortByFile = (a: Violation, b: Violation): number => {
if (a.file === undefined && b.file === undefined) {
return 0;
}
if (a.file === undefined) {
return -1
}
Expand All @@ -198,10 +201,13 @@ export function sortResults(results: DangerResults): DangerResults {
}

if (a.file == b.file) {
if (a.line == undefined) {
if (a.line === undefined && b.line === undefined) {
return 0;
}
if (a.line === undefined) {
return -1
}
if (b.line == undefined) {
if (b.line === undefined) {
return 1
}

Expand Down

0 comments on commit 7b60e62

Please sign in to comment.