From a647ffb21982d4b0248a0ca87399ba11d5462033 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Tue, 2 Dec 2025 14:53:07 +0000 Subject: [PATCH] refactor: Remove unreachable dead code branches - Host.ToFrontend: Remove redundant h.DisplayName check after struct initialization already set host.DisplayName = h.DisplayName Function now at 100% coverage. --- internal/models/converters.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/internal/models/converters.go b/internal/models/converters.go index dcea29d..b8ac272 100644 --- a/internal/models/converters.go +++ b/internal/models/converters.go @@ -318,12 +318,9 @@ func (h Host) ToFrontend() HostFrontend { LastSeen: h.LastSeen.Unix() * 1000, } - if host.DisplayName == "" { - if h.DisplayName != "" { - host.DisplayName = h.DisplayName - } else if h.Hostname != "" { - host.DisplayName = h.Hostname - } + // Fall back to Hostname if DisplayName is empty + if host.DisplayName == "" && h.Hostname != "" { + host.DisplayName = h.Hostname } if len(h.LoadAverage) > 0 {