-
Notifications
You must be signed in to change notification settings - Fork 116
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
Make the sphinx check more resilient #17701
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR aims to improve the resilience of the Sphinx build check by replacing a direct attribute access with a getattr call.
- Replace direct attribute access with getattr for builtins.sphinx_build
- Maintain fallback behavior when the attribute is missing
Reviewed Changes
File | Description |
---|---|
robottelo/config/init.py | Use getattr for the sphinx build check to avoid AttributeError |
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
robottelo/config/init.py:27
- Since hasattr is now enforced by using getattr with a default value, the AttributeError block should never be triggered. Consider removing the try/except block to simplify the code.
except AttributeError:
Just saw an issue in the robottelo CI where this popped up. File "/home/runner/work/robottelo/robottelo/robottelo/config/__init__.py", line 25, in get_settings if builtins.__sphinx_build__: ^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'builtins' has no attribute '__sphinx_build__' If we simply make this a getattr call, then we don't have to worry about that attribute being present.
a028121
to
7f70809
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR improves the resilience of the sphinx build check by replacing the try/except block with an inline getattr call on the builtins module.
- Replaces exception-based attribute access with getattr
- Returns early when sphinx_build is set to a truthy value
- Simplifies the control flow for clarity
Reviewed Changes
File | Description |
---|---|
robottelo/config/init.py | Updated the sphinx build check to use getattr and return early |
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Great review by Copilot! Expanded the scope a bit thanks to the feedback. |
trigger: test-robottelo |
PRT Result
|
The single PRT error is unrelated to this change. |
Just saw an issue in the robottelo CI where this popped up.
If we simply make this a getattr call, then we don't have to worry about that attribute being present.