-
Notifications
You must be signed in to change notification settings - Fork 367
Enable more ruff rules #6444
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
base: main
Are you sure you want to change the base?
Enable more ruff rules #6444
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.
Hey @KKoukiou - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
return True | ||
|
||
return False | ||
return any(source.network_required for source in self.sources) |
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.
nitpick: Use a generator expression with any() for conciseness and short-circuiting.
if val: | ||
return True | ||
return False | ||
return any(val for val in kernels.values()) |
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.
nitpick: Simplify loop using any() for readability.
@@ -137,7 +137,7 @@ def initialize(self): | |||
|
|||
# Start with the already set locale. Whether kickstart, geolocation, or default - it does | |||
# not matter, it's resolved and loaded by now. | |||
locales = [self._l12_module.Language] or [DEFAULT_LANG] |
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.
issue (bug_risk): Fix fallback logic to use DEFAULT_LANG when Language is falsy.
Previously, DEFAULT_LANG was never used due to the always-truthy list. This update ensures proper fallback.
if not conf.ui.show_kernel_options: | ||
return False | ||
for val in kernels.values(): | ||
if val: | ||
return True | ||
return False | ||
return any(val for val in kernels.values()) |
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.
suggestion (code-quality): We've found these issues:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
) - Simplify generator expression (
simplify-generator
)
if not conf.ui.show_kernel_options: | |
return False | |
for val in kernels.values(): | |
if val: | |
return True | |
return False | |
return any(val for val in kernels.values()) | |
return False if not conf.ui.show_kernel_options else any(kernels.values()) |
/kickstart-tests --testtype smoke |
This caught a real mistake in the code. In Python, non-empty lists are always truthy. So, this expression always evaluated to [self._l12_module.Language], regardless of what's inside. The intent was, use self._l12_module.Language if it's truthy, otherwise fall back to DEFAULT_LANG. Fix the code to do that.
e45d10f
to
6279479
Compare
/kickstart-tests --testtype smoke |
No description provided.