Skip to content

Commit

Permalink
Merge pull request #22 from odair-pedro/bugfix/quality-report
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 6cf6166 + a830a37 commit d6a214a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions decoration/azuredevops/template_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ func parseTemplateModel(qualityGate sonar.QualityGate) templateModel {
}

if tplModel.coverageStatus == "" {
tplModel.coverage = "-"
tplModel.coverage = "N/A"
tplModel.coverageStatus = "SUCCESS"
tplModel.coverageStatusColor = "green"
tplModel.coverageStatusColor = "lightgray"
}

return tplModel
Expand All @@ -86,7 +86,7 @@ func convertStatusColor(status string) string {
status = strings.ToUpper(status)
switch status {
case "OK":
return "green"
return "brightgreen"
case "ERROR":
return "red"
default:
Expand Down
4 changes: 2 additions & 2 deletions decoration/azuredevops/template_model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func Test_convertStatusColor(t *testing.T) {
args args
want string
}{
{name: "test-ok", args: args{status: "ok"}, want: "green"},
{name: "test-OK", args: args{status: "OK"}, want: "green"},
{name: "test-ok", args: args{status: "ok"}, want: "brightgreen"},
{name: "test-OK", args: args{status: "OK"}, want: "brightgreen"},
{name: "test-error", args: args{status: "error"}, want: "red"},
{name: "test-ERROR", args: args{status: "ERROR"}, want: "red"},
{name: "test-other", args: args{status: "other"}, want: "yellow"},
Expand Down
2 changes: 1 addition & 1 deletion decoration/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ const ReportTemplate = "## Quality Report\n" +
"| Reliability |[![Status](https://img.shields.io/badge/${rel-status}-${rel-status-color}?style=for-the-badge)](${host}/component_measures?id=${project}&metric=new_reliability_rating&pullRequest=${pullrequest}&view=list)|\n" +
"| Security |[![Status](https://img.shields.io/badge/${sec-status}-${sec-status-color}?style=for-the-badge)](${host}/component_measures?id=${project}&metric=new_security_rating&pullRequest=${pullrequest}&view=list)|\n" +
"| Maintainability |[![Status](https://img.shields.io/badge/${mtb-status}-${mtb-status-color}?style=for-the-badge)](${host}/component_measures?id=${project}&metric=new_maintainability_rating&pullRequest=${pullrequest}&view=list)|\n\n" +
"*Report auto generated by [**SonarCI**](https://odair-pedro.github.io/sonarci)*"
"*Report generated by [**SonarCI**](https://odair-pedro.github.io/sonarci)*"

0 comments on commit d6a214a

Please sign in to comment.