-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add config_dict and splitted rules capabilities Signed-off-by: develop-cs <[email protected]> * chore: fix pre-commit warnings Signed-off-by: develop-cs <[email protected]> * docs: add feature explanations Signed-off-by: develop-cs <[email protected]> * docs: typos Signed-off-by: develop-cs <[email protected]> * tests: typos Signed-off-by: develop-cs <[email protected]> * ✨ Add ignore rule feature * ✨ Add ignore rule feature * chore: refactoring Signed-off-by: develop-cs <[email protected]> * ci: fix pre-commit hooks Signed-off-by: develop-cs <[email protected]> --------- Signed-off-by: develop-cs <[email protected]> Signed-off-by: Charles <[email protected]> Co-authored-by: develop-cs <[email protected]>
- Loading branch information
1 parent
3bcf4e6
commit 86fcd7c
Showing
8 changed files
with
375 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
rules: | ||
default_rule_set: | ||
admission: | ||
ADM_OK: | ||
condition: HAS_SCHOOL_AUTHORIZED_POWER | ||
action: set_admission | ||
action_parameters: | ||
value: true | ||
ADM_KO: | ||
condition: null | ||
action: set_admission | ||
action_parameters: | ||
value: false | ||
course: | ||
COURSE_ENGLISH: | ||
condition: IS_SPEAKING_ENGLISH and not(IS_AGE_UNKNOWN) | ||
action: set_student_course | ||
action_parameters: | ||
course_id: "english" | ||
COURSE_SENIOR: | ||
condition: IS_AGE_UNKNOWN | ||
action: set_student_course | ||
action_parameters: | ||
course_id: "senior" | ||
COURSE_INTERNATIONAL: | ||
condition: not(IS_SPEAKING_ENGLISH) | ||
action: set_student_course | ||
action_parameters: | ||
course_id: "international" | ||
email: | ||
EMAIL_COOK: | ||
condition: HAS_SCHOOL_AUTHORIZED_POWER | ||
action: send_email | ||
action_parameters: | ||
mail_to: "[email protected]" | ||
mail_content: "Thanks for preparing once a month the following dish:" | ||
meal: input.favorite_meal | ||
|
||
conditions: | ||
HAS_SCHOOL_AUTHORIZED_POWER: | ||
description: "Does it have school authorized power?" | ||
validation_function: has_authorized_super_power | ||
condition_parameters: | ||
authorized_powers: | ||
- "strength" | ||
- "fly" | ||
- "immortality" | ||
candidate_powers: input.powers | ||
IS_SPEAKING_FRENCH: | ||
description: "Does it speak french?" | ||
validation_function: is_speaking_language | ||
condition_parameters: | ||
value: "french" | ||
spoken_language: input.language | ||
IS_SPEAKING_ENGLISH: | ||
description: "Does it speak english?" | ||
validation_function: is_speaking_language | ||
condition_parameters: | ||
value: "english" | ||
spoken_language: input.language | ||
IS_AGE_UNKNOWN: | ||
description: "Do we know his age?" | ||
validation_function: is_age_unknown | ||
condition_parameters: | ||
age: input.age | ||
HAS_FAVORITE_MEAL: | ||
description: "Does it have a favorite meal?" | ||
validation_function: has_favorite_meal | ||
condition_parameters: | ||
favorite_meal: input.favorite_meal | ||
|
||
|
||
conditions_source_modules: | ||
- "tests.examples.code.conditions" | ||
actions_source_modules: | ||
- "tests.examples.code.actions" | ||
|
||
parsing_error_strategy: raise | ||
|
||
custom_classes_source_modules: | ||
- "tests.examples.code.custom_class" | ||
condition_factory_mapping: | ||
custom_condition: "CustomCondition" |
26 changes: 26 additions & 0 deletions
26
tests/examples/simple_cond_conf/ignored_rules/rules_simple_cond_ignored_rules.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
# Global settings | ||
actions_source_modules: | ||
- "tests.examples.code.actions" | ||
|
||
# Rule sets for simple conditions tests | ||
rules: | ||
default_rule_set: | ||
admission: | ||
IGNORED_RULE_1: | ||
simple_condition: input.power=="strength" | ||
action: set_admission | ||
action_parameters: | ||
value: true | ||
IGNORED_RULE_2: | ||
simple_condition: input.dummy>1 | ||
action: set_admission | ||
action_parameters: | ||
value: true | ||
ADM_KO: | ||
simple_condition: null | ||
action: set_admission | ||
action_parameters: | ||
value: false | ||
|
||
parsing_error_strategy: raise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.