mirror of
https://github.com/securego/gosec.git
synced 2024-12-25 12:05:52 +00:00
Sort the issues by severity in descending order before creating the report
This commit is contained in:
parent
6b28d5c0e6
commit
d4ebb032a9
1 changed files with 8 additions and 0 deletions
|
@ -79,6 +79,9 @@ var (
|
||||||
// log to file or stderr
|
// log to file or stderr
|
||||||
flagLogfile = flag.String("log", "", "Log messages to file rather than stderr")
|
flagLogfile = flag.String("log", "", "Log messages to file rather than stderr")
|
||||||
|
|
||||||
|
// sort the issues by severity
|
||||||
|
flagSortIssues = flag.Bool("sort", true, "Sort issues by severity")
|
||||||
|
|
||||||
logger *log.Logger
|
logger *log.Logger
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -231,6 +234,11 @@ func main() {
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort the issue by severity
|
||||||
|
if *flagSortIssues {
|
||||||
|
sort.Slice(issues, func(i, j int) bool { return (issues[i].Severity > issues[j].Severity) })
|
||||||
|
}
|
||||||
|
|
||||||
// Create output report
|
// Create output report
|
||||||
if err := saveOutput(*flagOutput, *flagFormat, issues, metrics); err != nil {
|
if err := saveOutput(*flagOutput, *flagFormat, issues, metrics); err != nil {
|
||||||
logger.Fatal(err)
|
logger.Fatal(err)
|
||||||
|
|
Loading…
Reference in a new issue