1
0
mirror of https://github.com/securego/gosec.git synced 2025-02-09 13:14:05 +02:00
gosec/report/sonar/writer.go

23 lines
425 B
Go
Raw Normal View History

package sonar
import (
"encoding/json"
"io"
2021-05-20 10:16:42 +02:00
"github.com/securego/gosec/v2"
)
// WriteReport write a report in sonar format to the output writer
2021-05-20 10:16:42 +02:00
func WriteReport(w io.Writer, data *gosec.ReportInfo, rootPaths []string) error {
si, err := GenerateReport(rootPaths, data)
if err != nil {
return err
}
raw, err := json.MarshalIndent(si, "", "\t")
if err != nil {
return err
}
_, err = w.Write(raw)
return err
}