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

PLR1730 more aggressive with pylint 3.1.0 #10907

Closed
xrmx opened this issue Apr 12, 2024 · 1 comment · Fixed by #10920
Closed

PLR1730 more aggressive with pylint 3.1.0 #10907

xrmx opened this issue Apr 12, 2024 · 1 comment · Fixed by #10920
Labels
help wanted Contributions especially welcome rule Implementing or modifying a lint rule

Comments

@xrmx
Copy link

xrmx commented Apr 12, 2024

With the following snippet:

class Foo:
    _min = 0

    def foo(self, value):
        if value < self._min:
            self._min = value                             

pylint 3.1.0 returns:

foo.py:6:8: R1730: Consider using '_min = min(_min, value)' instead of unnecessary if block (consider-using-min-builtin)

ruff 0.3.7 does not report it. pylint 3.0.2 did not report it too.

@charliermarsh
Copy link
Member

Thanks!

@charliermarsh charliermarsh added rule Implementing or modifying a lint rule help wanted Contributions especially welcome labels Apr 12, 2024
charliermarsh added a commit that referenced this issue Apr 13, 2024
## Summary

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

Closes #10907 

## Test Plan

`cargo test`

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Contributions especially welcome rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants