// GetSeveritySummary returns the severity and summary of l
GetSeveritySummary returns the severity and summary of l
// GetSeveritySummary returns the severity and summary of l
func (l *VulnerabilityItemList) GetSeveritySummary() (Severity, *VulnerabilitySummary) {
	if l == nil {
		return Severity(""), nil
	}
	sum := &VulnerabilitySummary{
		Total:   len(l.Items()),
		Summary: make(SeveritySummary),
	}
	severity := None
	for _, v := range l.Items() {
		if num, ok := sum.Summary[v.Severity]; ok {
			sum.Summary[v.Severity] = num + 1
		} else {
			sum.Summary[v.Severity] = 1
		}
		if v.Severity.Code() > severity.Code() {
			severity = v.Severity
		}
		if len(v.FixVersion) > 0 {
			sum.Fixable++
		}
	}
	return severity, sum
}
func ( l * VulnerabilityItemList ) GetSeveritySummary ( ) ( Severity , * VulnerabilitySummary ) { if l == nil { return Severity ( " " ) , nil } sum := & VulnerabilitySummary { Total : len ( l . Items ( ) ) , Summary : make ( SeveritySummary ) , } severity := None for _ , v := range l . Items ( ) { if num , ok := sum . Summary [ v . Severity ] ; ok { sum . Summary [ v . Severity ] = num + 1 } else { sum . Summary [ v . Severity ] = 1 } if v . Severity . Code ( ) > severity . Code ( ) { severity = v . Severity } if len ( v . FixVersion ) > 0 { sum . Fixable ++ } } return severity , sum }
GetSeveritySummary returns the severity and summary of l
GetSeveritySummary returns the severity and summary of l
// Update the overall severity if necessary // If the CVE item has a fixable version