Skip to content

Commit

Permalink
fit: diff calculation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
vladopajic committed Nov 21, 2024
1 parent 099e1ff commit bc18bcc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/testcoverage/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})
}
}

Expand Down

0 comments on commit bc18bcc

Please sign in to comment.