Skip to content

Avoid dropping extra boolean operations in repeated-equality-comparison#12368

Merged
charliermarsh merged 1 commit intomainfrom
charlie/PLR1714
Jul 17, 2024
Merged

Avoid dropping extra boolean operations in repeated-equality-comparison#12368
charliermarsh merged 1 commit intomainfrom
charlie/PLR1714

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

Summary

Closes #12062.

@charliermarsh charliermarsh added the bug Something isn't working label Jul 17, 2024
@github-actions
Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+0 -1 violations, +0 -0 fixes in 1 projects; 53 projects unchanged)

bokeh/bokeh (+0 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select ALL

- src/bokeh/sphinxext/bokeh_sampledata_xref.py:180:16: PLR1714 Consider merging multiple comparisons: `node.subfolder in ('all', sp[-2])`. Use a `set` if the elements are hashable.

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PLR1714 1 0 1 0 0

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+0 -1 violations, +0 -0 fixes in 1 projects; 53 projects unchanged)

bokeh/bokeh (+0 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

- src/bokeh/sphinxext/bokeh_sampledata_xref.py:180:16: PLR1714 Consider merging multiple comparisons: `node.subfolder in ('all', sp[-2])`. Use a `set` if the elements are hashable.

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PLR1714 1 0 1 0 0

@charliermarsh charliermarsh merged commit 72e0220 into main Jul 17, 2024
@charliermarsh charliermarsh deleted the charlie/PLR1714 branch July 17, 2024 15:49
charliermarsh added a commit that referenced this pull request Jul 18, 2024
## 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: PLR1714 auto-fix with multiple conditions

1 participant