зеркало из https://github.com/golang/vulndb.git
cmd/inspect: add data on withdrawn and (un)reviewed reports
In the inspect command, display stats on the number of withdrawn and unreviewed reports in the corpus. Change-Id: I724a4f2bc00dbe279c2b20ecd9da5fcd961c029c Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/596181 Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Родитель
bbfc2dc6ae
Коммит
61369c8fa8
|
@ -107,6 +107,10 @@ func display(overall *summary, byYear map[int]*summary) {
|
|||
headings()
|
||||
data("Go reports", 0, func(s *summary) int { return s.reports })
|
||||
data("Regular reports", 1, func(s *summary) int { return s.regular })
|
||||
for _, rs := range []report.ReviewStatus{report.Reviewed, report.Unreviewed} {
|
||||
data(rs.String(), 2, func(s *summary) int { return s.regularByReview[rs] })
|
||||
}
|
||||
data("Withdrawn reports", 1, func(s *summary) int { return s.withdrawn })
|
||||
data("Excluded reports", 1, func(s *summary) int { return s.excluded })
|
||||
for _, er := range report.ExcludedReasons {
|
||||
data(string(er), 2, func(s *summary) int { return s.excludedByReason[er] })
|
||||
|
@ -138,15 +142,17 @@ func displayGHSAs(ghsas []string) {
|
|||
}
|
||||
|
||||
type summary struct {
|
||||
reports, regular, excluded, noGHSA, firstParty int
|
||||
ghsas int
|
||||
ghsasNotInVDB []string
|
||||
excludedByReason map[report.ExcludedReason]int
|
||||
reports, regular, withdrawn, excluded, noGHSA, firstParty int
|
||||
ghsas int
|
||||
ghsasNotInVDB []string
|
||||
excludedByReason map[report.ExcludedReason]int
|
||||
regularByReview map[report.ReviewStatus]int
|
||||
}
|
||||
|
||||
func newSummary() *summary {
|
||||
return &summary{
|
||||
excludedByReason: make(map[report.ExcludedReason]int),
|
||||
regularByReview: make(map[report.ReviewStatus]int),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,9 +185,15 @@ func summarize(ghsas []*genericosv.Entry, reports []*report.Report) (*summary, m
|
|||
|
||||
yearSummary.excluded++
|
||||
yearSummary.excludedByReason[r.Excluded]++
|
||||
} else if r.Withdrawn != nil {
|
||||
overall.withdrawn++
|
||||
yearSummary.withdrawn++
|
||||
} else {
|
||||
overall.regular++
|
||||
yearSummary.regular++
|
||||
|
||||
overall.regularByReview[r.ReviewStatus]++
|
||||
yearSummary.regularByReview[r.ReviewStatus]++
|
||||
}
|
||||
|
||||
if len(r.GHSAs) == 0 && r.CVEMetadata == nil {
|
||||
|
|
Загрузка…
Ссылка в новой задаче