Skip to content
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

[pylint] Support inverted comparisons (PLR1730) #10920

Merged
merged 2 commits into from
Apr 13, 2024

Conversation

diceroll123
Copy link
Contributor

Summary

Adds more aggressive logic to PLR1730, if-stmt-min-max

Closes #10907

Test Plan

cargo test

Copy link
Contributor

github-actions bot commented Apr 13, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

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

aws/aws-sam-cli (+4 -0 violations, +0 -0 fixes)

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

+ samcli/lib/observability/cw_logs/cw_log_puller.py:136:17: PLR1730 [*] Replace `if` statement with `max` call
+ samcli/lib/observability/xray_traces/xray_event_puller.py:163:21: PLR1730 [*] Replace `if` statement with `max` call
+ samcli/lib/observability/xray_traces/xray_events.py:52:13: PLR1730 [*] Replace `if` statement with `max` call
+ samcli/lib/observability/xray_traces/xray_events.py:87:13: PLR1730 [*] Replace `if` statement with `max` call

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

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

+ rotkehlchen/chain/evm/decoding/utils.py:42:13: PLR1730 [*] Replace `if` statement with `max` call

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

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

+ zerver/tests/test_openapi.py:344:13: PLR1730 [*] Replace `if` statement with `val = min(v, val)`

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

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

+ indico/modules/receipts/controllers/templates.py:218:17: PLR1730 [*] Replace `if` statement with `max_index = max(index, max_index)`

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PLR1730 7 7 0 0 0

Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@charliermarsh charliermarsh changed the title [pylint] - add more aggressive logic (PLR1730) [pylint] Support inverted comparisons (PLR1730) Apr 13, 2024
@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Apr 13, 2024
@charliermarsh charliermarsh enabled auto-merge (squash) April 13, 2024 22:50
@charliermarsh charliermarsh merged commit 812b097 into astral-sh:main Apr 13, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PLR1730 more aggressive with pylint 3.1.0
2 participants