Skip to content

Commit 1b28d32

Browse files
kmcrawfordgcmurphy
authored andcommitted
fix sonarIssues struct
1 parent 8eab50e commit 1b28d32

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

output/formatter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func CreateReport(w io.Writer, format, rootPath string, issues []*gosec.Issue, m
102102
}
103103

104104
func reportSonarqube(rootPath string, w io.Writer, data *reportInfo) error {
105-
var sonarIssues []sonarIssue
105+
var si sonarIssues
106106
for _, issue := range data.Issues {
107107
lines := strings.Split(issue.Line, "-")
108108

@@ -123,9 +123,9 @@ func reportSonarqube(rootPath string, w io.Writer, data *reportInfo) error {
123123
Severity: getSonarSeverity(issue.Severity.String()),
124124
EffortMinutes: 5,
125125
}
126-
sonarIssues = append(sonarIssues, s)
126+
si.SonarIssues = append(si.SonarIssues, s)
127127
}
128-
raw, err := json.MarshalIndent(sonarIssues, "", "\t")
128+
raw, err := json.MarshalIndent(si, "", "\t")
129129
if err != nil {
130130
panic(err)
131131
}

output/sonarqube_format.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ type sonarIssue struct {
2222
SecondaryLocations []location `json:"secondaryLocations,omitempty"`
2323
}
2424

25+
type sonarIssues struct {
26+
SonarIssues []sonarIssue `json:"issues"`
27+
}
28+
2529
func getSonarSeverity(s string) string {
2630
switch s {
2731
case "LOW":

0 commit comments

Comments
 (0)