-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to filter audit results by severity level #969
Conversation
Fairwinds Insights CI Report✅ No new Action Items detected! |
1 similar comment
Fairwinds Insights CI Report✅ No new Action Items detected! |
dda78ff
to
20b7d48
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:awesome:
resCopy := res | ||
resCopy.Results = []Result{} | ||
|
||
filteredResults := funk.Map(res.Results, func(auditDataResult Result) Result { | ||
return auditDataResult.filterResultsBySeverityLevel(severityLevel) | ||
}).([]Result) | ||
|
||
for _, result := range filteredResults { | ||
if result.isNotEmpty() { | ||
resCopy.Results = append(resCopy.Results, result) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Man 😓 the structure of the polaris output makes this harder than it should be.
Probably not for this PR, but if we wanted to do other kinds of filtering we could probably create a generic AuditData.filter
method that takes in a func(Result) bool
, so we only have to define the weird "drill into each result" logic in one place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that would be great, have some sort of filter function that takes a predicate
This PR fixes #
Checklist
Description
To address #754, I've chosen to implement verbosity options for displaying audit results in the same manner as log levels.
danger
is the least verbose option and will only include results of that severity.warning
is the medium verbosity option and will only display results of severitywarning
ordanger
. By default, all results will be displayed. This will still function with--only-show-failed-tests
and behave as expected.What's the goal of this PR?
Add verbosity options to the
audit
subcommand in the polaris CLIWhat changes did you make?
Low verbosity (
danger
)Medium verbosity (
warning
, also implies inclusion ofdanger
)What alternative solution should we consider, if any?