Skip to content

Commit

Permalink
Add dummy condition coverage from line coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabianexe committed Oct 22, 2024
1 parent 7a45f8a commit 5efded8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/writer/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,14 @@ func ConvertToCobertura(path string, project *entity.Project) *Coverage {
Hits: strconv.Itoa(line.CoverageCount),
Branch: "false",
}
if condition, ok := conditions[line.Number]; ok {
if _, ok := conditions[line.Number]; ok {
xmlLine.Branch = "true"
// Do not add condition coverage because we do not know the condtions
//xmlLine.ConditionCoverage = condition.String()
_ = condition
// write dummy condition depending on line coverage
if line.CoverageCount == 0 {
xmlLine.ConditionCoverage = "0.00 (0/1)"
} else {
xmlLine.ConditionCoverage = "1.00 (1/1)"
}
}

methodsLines.Lines = append(methodsLines.Lines, xmlLine)
Expand Down

0 comments on commit 5efded8

Please sign in to comment.