@@ -14,6 +14,7 @@ import (
1414 "net/url"
1515 "os"
1616 "os/exec"
17+ "strconv"
1718 "strings"
1819 "time"
1920
8182 CustomJvmParams string
8283 TaskId string
8384 SkipScan bool
85+ WaitQualityGate bool
8486 }
8587 Output struct {
8688 OutputFile string // File where plugin output are saved
@@ -179,6 +181,8 @@ type AnalysisResponse struct {
179181 } `json:"analyses"`
180182}
181183
184+ const lineBreak = "----------------------------------------------"
185+
182186func init () {
183187 netClient = & http.Client {
184188 Timeout : time .Second * 10 ,
@@ -277,15 +281,15 @@ func displaySummary(total, passed, failed int, errors int, newErrors int, projec
277281 fmt .Println ("Successfully closed .env file" )
278282 fmt .Print ("\n \n " )
279283 // Display the table
280- fmt .Println ("----------------------------------------------" )
284+ fmt .Println (lineBreak )
281285 fmt .Printf ("| STATUS | COUNT |\n " )
282- fmt .Println ("----------------------------------------------" )
286+ fmt .Println (lineBreak )
283287 fmt .Printf ("| (\033 [32mPASSED\033 [0m) | %d |\n " , passed )
284- fmt .Println ("----------------------------------------------" )
288+ fmt .Println (lineBreak )
285289 fmt .Printf ("| (\033 [31mFAILED\033 [0m) | %d |\n " , failed )
286- fmt .Println ("----------------------------------------------" )
290+ fmt .Println (lineBreak )
287291 fmt .Printf ("| TOTAL | %d |\n " , total )
288- fmt .Println ("----------------------------------------------" )
292+ fmt .Println (lineBreak )
289293 fmt .Printf ("\n \n Categorization: %s\n " , category )
290294}
291295
@@ -402,7 +406,7 @@ func (p Plugin) Exec() error {
402406 "-Dsonar.showProfiling" : p .Config .ShowProfiling ,
403407 "-Dsonar.java.binaries" : p .Config .Binaries ,
404408 "-Dsonar.branch.name" : p .Config .Branch ,
405- "-Dsonar.qualitygate.wait" : p .Config .QualityEnabled ,
409+ "-Dsonar.qualitygate.wait" : strconv . FormatBool ( p .Config .WaitQualityGate ) ,
406410 "-Dsonar.qualitygate.timeout" : p .Config .QualityTimeout ,
407411 "-Dsonar.javascript.lcov.reportPaths" : p .Config .JavascitptIcovReport ,
408412 "-Dsonar.coverage.jacoco.xmlReportPaths" : p .Config .JacocoReportPath ,
@@ -694,17 +698,17 @@ func (p Plugin) Exec() error {
694698}
695699
696700func displayQualityGateStatus (status string , qualityEnabled bool ) {
697- fmt .Println ("----------------------------------------------" )
701+ fmt .Println (lineBreak )
698702 fmt .Printf ("| QUALITY GATE STATUS REPORT |\n " )
699- fmt .Println ("----------------------------------------------" )
703+ fmt .Println (lineBreak )
700704
701705 if status == "OK" {
702706 fmt .Printf ("| STATUS | \033 [32m%s\033 [0m |\n " , status )
703707 } else {
704708 fmt .Printf ("| STATUS | \033 [31m%s\033 [0m |\n " , status )
705709 }
706710
707- fmt .Println ("----------------------------------------------" )
711+ fmt .Println (lineBreak )
708712
709713 if qualityEnabled {
710714 fmt .Printf ("| QUALITY GATE ENABLED | \033 [32mYES\033 [0m |\n " )
@@ -713,9 +717,9 @@ func displayQualityGateStatus(status string, qualityEnabled bool) {
713717 }
714718
715719 fmt .Printf ("----------------------------------------------\n \n " )
716- fmt .Println ("----------------------------------------------" )
720+ fmt .Println (lineBreak )
717721 fmt .Printf ("| Developed by: Diego Pereira |\n " )
718- fmt .Println ("----------------------------------------------" )
722+ fmt .Println (lineBreak )
719723}
720724
721725func staticScan (p * Plugin ) (* SonarReport , error ) {
@@ -778,7 +782,7 @@ func getStatus(task *TaskResponse, report *SonarReport) string {
778782 // JUNUT
779783 junitReport := ""
780784 junitReport = string (buf ) // returns a string of what was written to it
781- fmt .Println ("----------------------------------------------" )
785+ fmt .Println (lineBreak )
782786 fmt .Printf ("| SONAR SCAN + JUNIT EXPORTER PLUGIN |\n " )
783787 fmt .Print ("----------------------------------------------\n \n \n " )
784788 bytesReport := []byte (junitReport )
@@ -794,7 +798,7 @@ func getStatus(task *TaskResponse, report *SonarReport) string {
794798 file , _ := xml .MarshalIndent (result , "" , " " )
795799 _ = ioutil .WriteFile ("sonarResults.xml" , file , 0644 )
796800
797- fmt .Println ("----------------------------------------------" )
801+ fmt .Println (lineBreak )
798802 fmt .Printf ("| Harness Drone/CIE SonarQube Plugin Results |\n " )
799803 fmt .Print ("----------------------------------------------\n \n \n " )
800804
0 commit comments