mirror of
https://github.com/securego/gosec.git
synced 2024-12-26 04:25:52 +00:00
22 lines
434 B
Go
22 lines
434 B
Go
|
package sonar
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"github.com/securego/gosec/v2/report/core"
|
||
|
"io"
|
||
|
)
|
||
|
|
||
|
//WriteReport write a report in sonar format to the output writer
|
||
|
func WriteReport(w io.Writer, data *core.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
|
||
|
}
|