From 36e085e246b7439f4122fb65e114be600b6772a2 Mon Sep 17 00:00:00 2001 From: nutcas3 Date: Fri, 17 Apr 2026 16:31:26 +0300 Subject: [PATCH] refactor: Replace if-else chain with switch statement in showAlerts severity styling - Replace if-else chain with switch statement for severity level styling - Maintain existing logic: High maps to ERROR style, Medium maps to WARNING style - Improve code readability and maintainability --- apps/cli/internal/commands/monitoring.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/cli/internal/commands/monitoring.go b/apps/cli/internal/commands/monitoring.go index c2c9861..5177bc3 100644 --- a/apps/cli/internal/commands/monitoring.go +++ b/apps/cli/internal/commands/monitoring.go @@ -104,9 +104,10 @@ func showAlerts(u *uiContext) error { } for _, r := range rows { style := statusStyle(strings.ToUpper(r[0])) - if r[0] == "High" { + switch r[0] { + case "High": style = statusStyle("ERROR") - } else if r[0] == "Medium" { + case "Medium": style = statusStyle("WARNING") } t.AddStyledRow(style.Style, r[0], r[1], r[2], r[3])