feat: Fail-fast when instanciating checks with missing optional lib - #2565
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a centralized helper for optional dependencies and refactors the Readability and RegoPolicy checks to validate the presence of textstat and regorus at instantiation time using Pydantic model validators. While this ensures fail-fast behavior during validation, removing the defensive try-except blocks from the run() methods could lead to unhandled ImportError crashes if validation is bypassed (e.g., via model_construct or multiprocessing serialization). It is recommended to restore these defensive checks in the execution phase to ensure runtime robustness.
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.
Description
Fail-fast when instanciating checks with missing optional lib