-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[pylint] - use sets when possible for PLR1714 autofix (repeated-equality-comparison)
#14372
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
7809a3c to
d22ffd5
Compare
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PLR1714 | 62 | 31 | 31 | 0 | 0 |
d22ffd5 to
4b47271
Compare
|
Could we make this a preview only change? And could you update the test plan if you already went through the ecosystem changes? |
Preview check added! As for the ecosystem changes, seems fine with what's there, I'm all ears if not! |
…when all elements are hashable (`PLR1714`) (#16685) ## Summary This PR promotes the fix improvements for `PLR1714` that were introduced in #14372 to stable. The improvement is that the fix now proposes to use a set if all elements are hashable: ``` foo == "bar" or foo == "baz" or foo == "qux" ``` Gets fixed to ```py foo in {"bar", "baz", "qux"} ``` where it previously always got fixed to a tuple. The new fix was first released in ruff 0.8.0 (Nov last year). This is not a breaking change. The change was preview gated only to get some extra test coverage. There are no open issues or PRs related to this changed fix behavior.
…when all elements are hashable (`PLR1714`) (#16685) ## Summary This PR promotes the fix improvements for `PLR1714` that were introduced in #14372 to stable. The improvement is that the fix now proposes to use a set if all elements are hashable: ``` foo == "bar" or foo == "baz" or foo == "qux" ``` Gets fixed to ```py foo in {"bar", "baz", "qux"} ``` where it previously always got fixed to a tuple. The new fix was first released in ruff 0.8.0 (Nov last year). This is not a breaking change. The change was preview gated only to get some extra test coverage. There are no open issues or PRs related to this changed fix behavior.
…when all elements are hashable (`PLR1714`) (#16685) ## Summary This PR promotes the fix improvements for `PLR1714` that were introduced in #14372 to stable. The improvement is that the fix now proposes to use a set if all elements are hashable: ``` foo == "bar" or foo == "baz" or foo == "qux" ``` Gets fixed to ```py foo in {"bar", "baz", "qux"} ``` where it previously always got fixed to a tuple. The new fix was first released in ruff 0.8.0 (Nov last year). This is not a breaking change. The change was preview gated only to get some extra test coverage. There are no open issues or PRs related to this changed fix behavior.
Summary
Uses a set if we can determine that it should be used.
Test Plan
cargo test