Skip to content
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 an onlyX filter is an empty array #15117

Closed
wants to merge 1 commit into from

Conversation

OronW
Copy link

@OronW OronW commented May 27, 2023

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 and empty array of onlyCategories / onlyAudits is passed

In 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/missing audits 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, or logging a warning only.

* throw error if an onlyX filter is an empty array

* added tests to onlyX filters throwing error on empty array
@OronW OronW requested a review from a team as a code owner May 27, 2023 10:03
@OronW OronW requested review from brendankenny and removed request for a team May 27, 2023 10:03
@OronW OronW closed this May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant