-
Notifications
You must be signed in to change notification settings - Fork 2.1k
ruff issues #19787
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
ruff issues #19787
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 addresses new linter warnings from ruff
by tightening split operations, improving parsing logic, and updating test syntax.
- Added
maxsplit=1
to varioussplit
calls to prevent over-splitting. - Refactored a directory name check in
block_tools.py
for clarity. - Enhanced CLI argument parsing for
ip:port
inputs and standardized test error assertion syntax.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
chia/util/virtual_project_analysis.py | Added maxsplit=1 to identifier.split( to satisfy linter warnings. |
chia/simulator/block_tools.py | Broke out split(..., maxsplit=1) calls and adjusted line breaks. |
chia/cmds/peer_funcs.py | Switched to split(":", maxsplit=1) and validated the ip:port pair. |
chia/cmds/configure.py | Replaced .index with split(":", maxsplit=1) to parse host and port. |
chia/_tests/plot_sync/test_sender.py | Converted pytest.raises to context-manager form. |
Comments suppressed due to low confidence (4)
chia/simulator/block_tools.py:1738
- [nitpick] Consider extracting the common base directory logic for
plot_dir_name
into a variable to avoid repeatedsplit
calls and improve readability.
or root_dir.parts[-1] == plot_dir_name.split("\\", maxsplit=1)[0]
chia/cmds/peer_funcs.py:11
- [nitpick] Consider using a robust parsing function or the
ipaddress
module to properly handle IPv6 addresses and host:port splitting instead of manualsplit
logic.
ip_port = add_connection.split(":", maxsplit=1)
chia/cmds/configure.py:45
- If
set_node_introducer
does not contain a colon, this code silently skips setting host and port without feedback; add anelse
branch or input validation to inform the user of invalid format.
host_port = set_node_introducer.split(":", maxsplit=1)
chia/cmds/configure.py:57
- Similarly, for
set_farmer_peer
, if no colon is present, the code will silently do nothing; add anelse
clause to handle invalid input and notify the user.
host_port = set_farmer_peer.split(":", maxsplit=1)
5f39318
to
4d98cb9
Compare
coverage report:
|
Hmm, yeah, that ain't good. I suppose I need to actually at least try this. |
Added coverage diff label for now, since convo seems like we might try and resolve those (and it was unable to be added automatically since it was from a fork). |
Pull Request Test Coverage Report for Build 16209809517Details
💛 - Coveralls |
There is a dependabot PR to update ruff: #19793 I think it would be useful to see if that introduces any further changes. |
I tried that. There are some errors in some very dumb test types This patch lets us go to 0.12.1. Let's try to get this one through first. |
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.
looks reasonable. feel free to resolve my tickets if you don't think they need to be addressed
I think it's ready to be merged. |
Fix some issues that
ruff
identifies starting only recently (probably due to ruff improving).