-
Notifications
You must be signed in to change notification settings - Fork 39
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
support lists of resources in rules #3
Conversation
linter/resource_linter.go
Outdated
assertion.Debugf("using the rule - list of resources") | ||
filteredResources = assertion.FilterResourcesByTypes(resources, rule.Resources, rule.Category) | ||
} | ||
for _, resource := range filteredResources { |
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.
I would recommend extracting these lines into a new filter function in assertion/util.go. Maybe call it FilterResourcesForRule? Pass the list of Resource objects and the entire Rule object. That would keep this loop code more concise, and groups all the filtering logic together in the same package. What do you think?
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.
I agree, this is a cleaner way of doing things.
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.
I agree, this is a cleaner way of doing things.
linter/resource_linter.go
Outdated
assertion.Debugf("using the rule - list of resources") | ||
filteredResources = assertion.FilterResourcesByTypes(resources, rule.Resources, rule.Category) | ||
} | ||
for _, resource := range filteredResources { |
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.
I agree, this is a cleaner way of doing things.
closes #2