Skip to content

Commit 7b60e62

Browse files
authoredNov 2, 2022
fix messing the order of messages
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.
1 parent 0c8804f commit 7b60e62

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
 

‎source/dsl/DangerResults.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ export function sortInlineResults(inlineResults: DangerInlineResults[]): DangerI
190190

191191
export function sortResults(results: DangerResults): DangerResults {
192192
const sortByFile = (a: Violation, b: Violation): number => {
193+
if (a.file === undefined && b.file === undefined) {
194+
return 0;
195+
}
193196
if (a.file === undefined) {
194197
return -1
195198
}
@@ -198,10 +201,13 @@ export function sortResults(results: DangerResults): DangerResults {
198201
}
199202

200203
if (a.file == b.file) {
201-
if (a.line == undefined) {
204+
if (a.line === undefined && b.line === undefined) {
205+
return 0;
206+
}
207+
if (a.line === undefined) {
202208
return -1
203209
}
204-
if (b.line == undefined) {
210+
if (b.line === undefined) {
205211
return 1
206212
}
207213

0 commit comments

Comments
 (0)
Please sign in to comment.