Skip to content

Commit 83b257d

Browse files
Update plugin.go
1 parent 439aac1 commit 83b257d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

plugin.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,11 @@ func (p Plugin) Exec() error {
473473
params := strings.Split(p.Config.CustomJvmParams, ",")
474474
args = append(args, params...)
475475
}
476-
workspaceFolder := ".scannerwork/report-task.txt"
476+
taskFilePath := ".scannerwork/report-task.txt"
477477

478478
if len(p.Config.Workspace) >= 1 {
479479
args = append(args, "-Dsonar.projectBaseDir="+p.Config.Workspace)
480-
workspaceFolder = p.Config.Workspace+"/.scannerwork/report-task.txt"
480+
taskFilePath = p.Config.Workspace+"/.scannerwork/report-task.txt"
481481
}
482482

483483
// Assuming your struct has a print or log method
@@ -533,7 +533,7 @@ func (p Plugin) Exec() error {
533533
fmt.Printf("\n==> Sonar Analysis Finished!\n\n")
534534
fmt.Printf("\n\nStatic Analysis Result:\n\n")
535535

536-
cmd = exec.Command("cat", workspaceFolder)
536+
cmd = exec.Command("cat", taskFilePath)
537537

538538
cmd.Stdout = os.Stdout
539539

@@ -555,7 +555,7 @@ func (p Plugin) Exec() error {
555555
fmt.Printf("\n\nParsing Results:\n\n")
556556
fmt.Printf("\n")
557557

558-
report, err := staticScan(&p)
558+
report, err := staticScan(&p, taskFilePath)
559559

560560
if err != nil {
561561
logrus.WithFields(logrus.Fields{
@@ -646,9 +646,9 @@ func displayQualityGateStatus(status string, qualityEnabled bool) {
646646
fmt.Println(lineBreak)
647647
}
648648

649-
func staticScan(p *Plugin) (*SonarReport, error) {
649+
func staticScan(p *Plugin, taskFilePath String) (*SonarReport, error) {
650650

651-
cmd := exec.Command("sed", "-e", "s/=/=\"/", "-e", "s/$/\"/", ".scannerwork/report-task.txt")
651+
cmd := exec.Command("sed", "-e", "s/=/=\"/", "-e", "s/$/\"/", taskFilePath)
652652
output, err := cmd.CombinedOutput()
653653
if err != nil {
654654
logrus.WithFields(logrus.Fields{

0 commit comments

Comments
 (0)