-
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
Allow repeated-equality-comparison
for mixed operations
#12369
Merged
Merged
Conversation
This file contains 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
charliermarsh
force-pushed
the
charlie/mixed
branch
from
July 17, 2024 15:39
72bca7f
to
b2c79ab
Compare
Actually, I may change this to only merge adjacent values, like #7797. |
charliermarsh
force-pushed
the
charlie/mixed
branch
from
July 17, 2024 15:49
b2c79ab
to
e017353
Compare
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PLR1714 | 12 | 12 | 0 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+12 -0 violations, +0 -0 fixes in 7 projects; 47 projects unchanged)
apache/airflow (+2 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
+ airflow/providers/cncf/kubernetes/triggers/pod.py:313:13: PLR1714 Consider merging multiple comparisons. Use a `set` if the elements are hashable. + airflow/providers/teradata/operators/teradata_compute_cluster.py:122:13: PLR1714 Consider merging multiple comparisons: `self.compute_profile_name in ("None", "")`. Use a `set` if the elements are hashable.
apache/superset (+1 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
+ superset/utils/core.py:311:13: PLR1714 Consider merging multiple comparisons: `standalone_param not in ("false", "0")`. Use a `set` if the elements are hashable.
bokeh/bokeh (+2 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
+ src/bokeh/core/has_props.py:280:24: PLR1714 Consider merging multiple comparisons: `head in ("bokeh", "__main__")`. Use a `set` if the elements are hashable. + tests/unit/bokeh/test_layouts.py:292:12: PLR1714 Consider merging multiple comparisons: `t5 not in (save0, save1)`. Use a `set` if the elements are hashable.
pandas-dev/pandas (+2 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ pandas/core/dtypes/astype.py:128:8: PLR1714 Consider merging multiple comparisons: `object in (arr.dtype, dtype)`. Use a `set` if the elements are hashable. + pandas/core/nanops.py:460:13: PLR1714 Consider merging multiple comparisons: `values.dtype not in (object, bool)`. Use a `set` if the elements are hashable.
rotki/rotki (+3 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ rotkehlchen/__main__.py:22:12: PLR1714 Consider merging multiple comparisons: `e.code in (0, 2)`. Use a `set` if the elements are hashable. + rotkehlchen/chain/evm/decoding/curve/decoder.py:542:18: PLR1714 Consider merging multiple comparisons: `event.asset in (self.native_currency, sold_asset)`. Use a `set` if the elements are hashable. + rotkehlchen/chain/evm/decoding/curve/decoder.py:554:18: PLR1714 Consider merging multiple comparisons. Use a `set` if the elements are hashable.
zulip/zulip (+1 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
+ zerver/webhooks/opbeat/view.py:82:16: PLR1714 Consider merging multiple comparisons: `key_raw not in ("html_url", "subject")`. Use a `set` if the elements are hashable.
wntrblm/nox (+1 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ nox/manifest.py:322:16: PLR1714 Consider merging multiple comparisons: `session in (s, s.name)`. Use a `set` if the elements are hashable.
Changes by rule (1 rules affected)
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PLR1714 | 12 | 12 | 0 | 0 | 0 |
dhruvmanila
reviewed
Jul 18, 2024
...nt/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap
Outdated
Show resolved
Hide resolved
dhruvmanila
reviewed
Jul 18, 2024
crates/ruff_linter/src/rules/pylint/rules/repeated_equality_comparison.rs
Outdated
Show resolved
Hide resolved
charliermarsh
force-pushed
the
charlie/mixed
branch
from
July 18, 2024 14:56
309fd78
to
b6471a2
Compare
dhruvmanila
approved these changes
Jul 18, 2024
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
This PR allows us to fix both expressions in
foo == "a" or foo == "b" or ("c" != bar and "d" != bar)
, but limits the rule to consecutive comparisons, following #7797.I think this logic was probably added because of #12368 -- the intent being that we'd replace the entire expression.