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

Support a user-defined function for --rule-list-split option #365

Merged
merged 1 commit into from
Dec 21, 2022

Conversation

bmish
Copy link
Owner

@bmish bmish commented Dec 20, 2022

Fixes #294.

The implementation of this is pretty simple because we now allow the user to provide the same function we use internally to split lists. The more complex part is dealing with the various kinds of values that are now allowed for this option.

TODO:

  • Add more documentation
  • Add more comments to new types
  • Too many disable comments in validation code
  • Throw if function returns no sections or no rules in a section
  • Throw if a list contains the same rule twice
  • Use ajv to validate return value of user-defined function

Open question:

  • Should the function return value include the list of tuples [ruleName, rule] which is the same format it is passed, or should it just include the list of rule name strings? I have chosen to stick with the tuples because this allows very simple filtering without having to map the filtering results to the rule name.

Potential follow-up

@bmish bmish added the enhancement New feature or request label Dec 20, 2022
@bmish bmish force-pushed the rule-list-split-function branch 3 times, most recently from 1bfd31f to 8d57168 Compare December 20, 2022 03:37
@bmish bmish marked this pull request as ready for review December 20, 2022 03:48
@bmish bmish force-pushed the rule-list-split-function branch 7 times, most recently from db9c998 to 718d15b Compare December 21, 2022 01:09
@bmish bmish merged commit b942e58 into main Dec 21, 2022
@bmish bmish deleted the rule-list-split-function branch December 21, 2022 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow custom function to be specified for splitting/ordering of sub-lists when using --rule-list-split option
2 participants