Skip to content

Commit

Permalink
Merge pull request #21 from odair-pedro/bugfix/report-coverage
Browse files Browse the repository at this point in the history
Fix PR decoration for quality gate without coverage rating
  • Loading branch information
odair-pedro authored Oct 26, 2020
2 parents 0b706e7 + 064fe5b commit 6cf6166
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion decoration/azuredevops/template_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func parseTemplateModel(qualityGate sonar.QualityGate) templateModel {
sec := qualityGate.Conditions[keyNewSecurityRating]
mtb := qualityGate.Conditions[keyNewMaintainabilityRating]

return templateModel{
tplModel := templateModel{
host: qualityGate.Host,
project: qualityGate.Project,
pullRequest: qualityGate.Source,
Expand All @@ -60,6 +60,14 @@ func parseTemplateModel(qualityGate sonar.QualityGate) templateModel {
maintainabilityStatus: convertStatus(mtb.Status),
maintainabilityStatusColor: convertStatusColor(mtb.Status),
}

if tplModel.coverageStatus == "" {
tplModel.coverage = "-"
tplModel.coverageStatus = "SUCCESS"
tplModel.coverageStatusColor = "green"
}

return tplModel
}

func convertStatus(status string) string {
Expand Down

0 comments on commit 6cf6166

Please sign in to comment.