[pylint] - use sets when possible for PLR1714 autofix (repeated-equality-comparison)#14372
Merged
MichaReiser merged 4 commits intoastral-sh:mainfrom Nov 18, 2024
Merged
Conversation
7809a3c to
d22ffd5
Compare
Contributor
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PLR1714 | 62 | 31 | 31 | 0 | 0 |
d22ffd5 to
4b47271
Compare
Member
|
Could we make this a preview only change? And could you update the test plan if you already went through the ecosystem changes? |
Contributor
Author
Preview check added! As for the ecosystem changes, seems fine with what's there, I'm all ears if not! |
MichaReiser
added a commit
that referenced
this pull request
Mar 13, 2025
…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.
MichaReiser
added a commit
that referenced
this pull request
Mar 13, 2025
…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.
MichaReiser
added a commit
that referenced
this pull request
Mar 13, 2025
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Uses a set if we can determine that it should be used.
Test Plan
cargo test