Skip to content

Commit

Permalink
Merge pull request #3 from aquasecurity/liamg-default-severity
Browse files Browse the repository at this point in the history
Tweak for non-pointered results in set
  • Loading branch information
liamg authored Aug 23, 2021
2 parents 608a2f4 + e91f428 commit f11999b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions result/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ type Set interface {
WithResolution(resolution string) Set
WithLinks(links []string) Set
WithSeverity(severity.Severity) Set
All() []*Result
All() []Result
}

func NewSet() *resultSet {
return &resultSet{}
}

type resultSet struct {
results []*Result
results []Result
ruleID string
legacyID string
ruleSummary string
Expand All @@ -37,6 +37,10 @@ type resultSet struct {

func (s *resultSet) Add(r *Result) {

if r == nil {
return
}

r.WithRuleID(s.ruleID).
WithLegacyRuleID(s.legacyID).
WithRuleSummary(s.ruleSummary).
Expand All @@ -49,7 +53,7 @@ func (s *resultSet) Add(r *Result) {
r.WithSeverity(s.severity)
}

s.results = append(s.results, r)
s.results = append(s.results, *r)
}

func (s *resultSet) WithSeverity(severity severity.Severity) Set {
Expand All @@ -66,11 +70,11 @@ func (s *resultSet) AddResult() *Result {
WithResolution(s.resolution).
WithRuleProvider(s.ruleProvider).
WithLinks(s.links)
s.results = append(s.results, result)
s.results = append(s.results, *result)
return result
}

func (s *resultSet) All() []*Result {
func (s *resultSet) All() []Result {
return s.results
}

Expand Down

0 comments on commit f11999b

Please sign in to comment.