feat: EvaluatorRuleArgs允许自由拓展#431
Conversation
There was a problem hiding this comment.
Code Review
This pull request simplifies rule configuration by allowing EvaluatorRuleArgs to accept extra fields directly, removing the need for a nested parameters dictionary. The documentation and the RuleDictConsistency rule have been updated to reflect this change. The review feedback points out a potential issue where getattr might return None if ignore_order is explicitly configured as null, and suggests a robust boolean check to ensure it defaults to True correctly.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| right_dict = getattr(input_data, "context", None) | ||
| parameters = cls.dynamic_config.parameters or {} | ||
| ignore_order = parameters.get("ignore_order", True) | ||
| ignore_order = getattr(cls.dynamic_config, "ignore_order", True) |
There was a problem hiding this comment.
When retrieving the dynamic configuration ignore_order using getattr, if the attribute is explicitly configured as None (e.g., "ignore_order": null in JSON), getattr will return None instead of the default value True. Since _normalize_value expects a boolean, this can lead to unexpected behavior where ignore_order is treated as False (falsy) but passed recursively as None.
To ensure robust defensive programming and guarantee that ignore_order is always a proper boolean (defaulting to True unless explicitly set to False), we can use is not False comparison.
| ignore_order = getattr(cls.dynamic_config, "ignore_order", True) | |
| ignore_order = getattr(cls.dynamic_config, "ignore_order", True) is not False |
No description provided.