-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Omit repeated equality comparison for sys #10054
Omit repeated equality comparison for sys #10054
Conversation
{ | ||
let excluder = Regex::new(r"^(platform|version)").unwrap(); | ||
return !excluder.is_match(left.clone().expect_attribute_expr().attr.as_str()); | ||
} |
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.
Thanks! Can you try something like:
any_over_expr(test, &|expr| {
semantic.resolve_call_path(expr).is_some_and(|call_path| {
matches!(call_path.as_slice(), ["sys", "version_info" | "platform"])
})
})
This is roughly taken from a helper we have called is_sys_version_block
.
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.
Just putting this back in your queue :)
|
Sorry, I couldn't get to this in time. Thank you! |
No prob, I was just in PR-closing-mode and took advantage of being in the area. Thanks for contributing! |
## Summary Update PLR1714 to ignore `sys.platform` and `sys.version` checks. I'm not sure if these checks or if we need to add more. Please advise. Fixes astral-sh#10017 ## Test Plan Added a new test case and ran `cargo nextest run`
Summary
Update PLR1714 to ignore
sys.platform
andsys.version
checks.I'm not sure if these checks or if we need to add more. Please advise.
Fixes #10017
Test Plan
Added a new test case and ran
cargo nextest run