-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[CHIA-3633] August 2025 pass of Ruff linting rules #19929
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
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.
Pull Request Overview
This PR enables 6 new Ruff linting rules and removes one unused ignore rule to improve code quality. The changes focus on simplifying control flow by collapsing else-if
statements and resolving variable shadowing issues.
- Converts nested
else-if
statements toelif
for cleaner control flow - Fixes variable shadowing where loop variables or function parameters reused names in their scope
- Removes unnecessary type casting to
int
where the operation already returns an integer
Reviewed Changes
Copilot reviewed 57 out of 57 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tools/cpu_utilization.py | Adds noqa comment for loop variable modification |
ruff.toml | Removes 6 ignored Ruff rules to enable new linting checks |
chia/wallet/wallet_transaction_store.py | Simplifies nested else-if to elif |
chia/wallet/wallet_state_manager.py | Fixes variable shadowing by renaming variables |
chia/wallet/wallet_node.py | Converts multiple nested else-if statements to elif |
chia/wallet/vc_wallet/vc_wallet.py | Simplifies nested conditional structure |
chia/wallet/util/merkle_utils.py | Resolves variable shadowing in loop |
chia/wallet/puzzle_drivers.py | Converts else-if to elif |
chia/wallet/nft_wallet/nft_wallet.py | Fixes variable shadowing in loop |
chia/wallet/cat_wallet/cat_outer_puzzle.py | Resolves variable shadowing |
Multiple other files | Similar pattern of else-if to elif conversions and variable shadowing fixes |
|
coverage exempted |
It's been a couple of months since the most recent rules were added to Ruff so I figured it's time to do another pass of some low-hanging fruit of rules to enable.
This PR enables 6 new rules and deletes one unused ignore. It's highly recommended to review the PR one commit at a time and for the
elif
change to hide whitespace.