From bc18bcc72c6fa404dc2fd25567d112d26e09a156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vlado=20Paji=C4=87?= Date: Thu, 21 Nov 2024 21:25:28 +0100 Subject: [PATCH] fit: diff calculation logic --- pkg/testcoverage/types.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/testcoverage/types.go b/pkg/testcoverage/types.go index 234f3c8..e853cdf 100644 --- a/pkg/testcoverage/types.go +++ b/pkg/testcoverage/types.go @@ -89,14 +89,17 @@ func calculateStatsDiff(current, base []coverage.Stats) []FileCoverageDiff { baseSearchMap := coverage.StatsSearchMap(base) for _, s := range current { + sul := s.UncoveredLines() + if sul == 0 { + continue + } + if b, found := baseSearchMap[s.Name]; found { - if s.UncoveredLines() != b.UncoveredLines() { + if sul != b.UncoveredLines() { res = append(res, FileCoverageDiff{Current: s, Base: &b}) } } else { - if s.UncoveredLines() > 0 { - res = append(res, FileCoverageDiff{Current: s}) - } + res = append(res, FileCoverageDiff{Current: s}) } }