Skip to content

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

KKoukiou
Copy link
Contributor

@KKoukiou KKoukiou commented Jun 5, 2025

No description provided.

@KKoukiou KKoukiou temporarily deployed to gh-cockpituous June 5, 2025 05:51 — with GitHub Actions Inactive
@github-actions github-actions bot added the f43 label Jun 5, 2025
Copy link

@sourcery-ai sourcery-ai bot left a 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

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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)
Copy link

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())
Copy link

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]
Copy link

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.

Comment on lines 383 to +385
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())
Copy link

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:

Suggested change
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())

@KKoukiou KKoukiou requested a review from adamkankovsky June 5, 2025 06:28
@KKoukiou
Copy link
Contributor Author

KKoukiou commented Jun 5, 2025

/kickstart-tests --testtype smoke

KKoukiou added 5 commits June 5, 2025 09:27
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.
@KKoukiou KKoukiou force-pushed the enable-more-ruff-rules branch from e45d10f to 6279479 Compare June 5, 2025 07:29
@KKoukiou KKoukiou temporarily deployed to gh-cockpituous June 5, 2025 07:29 — with GitHub Actions Inactive
@KKoukiou
Copy link
Contributor Author

KKoukiou commented Jun 5, 2025

/kickstart-tests --testtype smoke

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

1 participant