Skip to content

feat: Fail-fast when instanciating checks with missing optional lib - #2565

Merged
kevinmessiaen merged 3 commits into
mainfrom
feat/check-missing-deps-fail-fast
Jun 29, 2026
Merged

feat: Fail-fast when instanciating checks with missing optional lib#2565
kevinmessiaen merged 3 commits into
mainfrom
feat/check-missing-deps-fail-fast

Conversation

@kevinmessiaen

Copy link
Copy Markdown
Member

Description

Fail-fast when instanciating checks with missing optional lib

@kevinmessiaen
kevinmessiaen requested a review from henchaves June 26, 2026 03:50

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread libs/giskard-checks/src/giskard/checks/builtin/nlp_metrics.py
Comment thread libs/giskard-checks/src/giskard/checks/builtin/rego_policy.py
@kevinmessiaen
kevinmessiaen merged commit 962ae81 into main Jun 29, 2026
46 checks passed
@kevinmessiaen
kevinmessiaen deleted the feat/check-missing-deps-fail-fast branch June 29, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants