Skip to content

Commit 78a0251

Browse files
committed
fix(fixer): dedupe error message on conflicts from the same linter
For example, modernize's omitzero produces this. Better to say > conflicting edits from modernize on ... ...than: > conflicting edits from modernize and modernize on ...
1 parent c5e3dec commit 78a0251

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/result/processors/fixer.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,10 @@ func diff3Conflict(path, xlabel, ylabel string, xedits, yedits []diff.Edit) erro
301301
return err
302302
}
303303

304-
return fmt.Errorf("conflicting edits from %s and %s on %s\nfirst edits:\n%s\nsecond edits:\n%s",
305-
xlabel, ylabel, path, xdiff, ydiff)
304+
from := xlabel
305+
if from != ylabel {
306+
from += " and " + ylabel
307+
}
308+
return fmt.Errorf("conflicting edits from %s on %s\nfirst edits:\n%s\nsecond edits:\n%s",
309+
from, path, xdiff, ydiff)
306310
}

0 commit comments

Comments
 (0)