tools: Add colored icons to the CTS roll msgs

Should help quickly identify errors vs warnings vs notes

Bug: dawn:1342
Change-Id: I8063be0d7cff06428be998a6fa0ad76048ccbc29
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91960
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2022-05-30 16:36:18 +00:00 committed by Dawn LUCI CQ
parent 1b69b8ad99
commit 53edbc7635
1 changed files with 10 additions and 1 deletions

View File

@ -467,11 +467,20 @@ func (r *roller) rollCommitMessage(
func (r *roller) postComments(ps gerrit.Patchset, diags []expectations.Diagnostic, results result.List) error { func (r *roller) postComments(ps gerrit.Patchset, diags []expectations.Diagnostic, results result.List) error {
fc := make([]gerrit.FileComment, len(diags)) fc := make([]gerrit.FileComment, len(diags))
for i, d := range diags { for i, d := range diags {
var prefix string
switch d.Severity {
case expectations.Error:
prefix = "🟥"
case expectations.Warning:
prefix = "🟨"
case expectations.Note:
prefix = "🟦"
}
fc[i] = gerrit.FileComment{ fc[i] = gerrit.FileComment{
Path: common.RelativeExpectationsPath, Path: common.RelativeExpectationsPath,
Side: gerrit.Left, Side: gerrit.Left,
Line: d.Line, Line: d.Line,
Message: fmt.Sprintf("%v: %v", d.Severity, d.Message), Message: fmt.Sprintf("%v %v: %v", prefix, d.Severity, d.Message),
} }
} }