mirror of
https://github.com/securego/gosec.git
synced 2025-03-01 04:33:29 +00:00
fix sonarIssues struct
This commit is contained in:
parent
8eab50eb17
commit
1b28d323d8
2 changed files with 7 additions and 3 deletions
|
@ -102,7 +102,7 @@ func CreateReport(w io.Writer, format, rootPath string, issues []*gosec.Issue, m
|
|||
}
|
||||
|
||||
func reportSonarqube(rootPath string, w io.Writer, data *reportInfo) error {
|
||||
var sonarIssues []sonarIssue
|
||||
var si sonarIssues
|
||||
for _, issue := range data.Issues {
|
||||
lines := strings.Split(issue.Line, "-")
|
||||
|
||||
|
@ -123,9 +123,9 @@ func reportSonarqube(rootPath string, w io.Writer, data *reportInfo) error {
|
|||
Severity: getSonarSeverity(issue.Severity.String()),
|
||||
EffortMinutes: 5,
|
||||
}
|
||||
sonarIssues = append(sonarIssues, s)
|
||||
si.SonarIssues = append(si.SonarIssues, s)
|
||||
}
|
||||
raw, err := json.MarshalIndent(sonarIssues, "", "\t")
|
||||
raw, err := json.MarshalIndent(si, "", "\t")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
@ -22,6 +22,10 @@ type sonarIssue struct {
|
|||
SecondaryLocations []location `json:"secondaryLocations,omitempty"`
|
||||
}
|
||||
|
||||
type sonarIssues struct {
|
||||
SonarIssues []sonarIssue `json:"issues"`
|
||||
}
|
||||
|
||||
func getSonarSeverity(s string) string {
|
||||
switch s {
|
||||
case "LOW":
|
||||
|
|
Loading…
Reference in a new issue