-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core(config): throw an error if a filter is an empty array #15118
base: main
Are you sure you want to change the base?
Conversation
* throw error if an onlyX filter is an empty array * added tests to onlyX filters throwing error on empty array
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.
Looks good! CI is currently broken for unrelated reasons so we can merge once that's fixed.
Sorry to reopen the bikeshed for #14986: I'm kind of hung up on the fact that you're allowed to have a config with (I feel the same way about Could be a warning instead? |
Isn't this use case covered by supplying I don't think trimming off the minimal data in |
It's not adding complication, it works by default :) Adding new thrown errors is the extra complication, which is pretty much my objection as well. #14986 says that the mental model of filtering the categories to only those listed in The problem wasn't fatal, it was that |
@connorjclark @adamraine @brendankenny Please let me know what's decided, so this PR will not hang and I could work on it if needed. |
Summary
This is a bugfix, which fixes this issue:
#14986
Logic fix and relevant unit tests were added.
Description
TLDR: Throw an Error In case an empty array of
onlyCategories
/onlyAudits
is passedIn the case an empty array of
onlyCategories
is passed, all categories are filtered (as only 0 categories are to be kept).This results in an unexpected behavior, as an empty array might be interpreted as "don't filter anything".
Since passing an empty array serves no use, an error is thrown.
TBD
The original issue referred to throwing an error also for the case in which
audits
is left empty after filtering, however empty/missingaudits
is being handled in following code, and throwing an error breaks this logic.Throwing an error for empty
audits
also breaks 30 tests.I would suggest not changing any
audits
logic.