-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[false-negative] Fix 8947 for consider-using-min/max-builtin #9127
Conversation
issue opened with 2 failing positive cases. added 2 negative cases of similar form
Altered order of checks to be more understanding towards statements written in the reverse order of expected.
@Pierre-Sassoulas When you have a chance, could you kindly review? False Negative fix for |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #9127 +/- ##
=======================================
Coverage 95.76% 95.76%
=======================================
Files 173 173
Lines 18665 18664 -1
=======================================
Hits 17874 17874
+ Misses 791 790 -1
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The primer looks pretty good, there's no false positive there. Do you think it's possible to include the examples from the original issue with a cast to float in order to deal withoffset + value
on top of the Name
/ Const
? If it's a lot of work we might merge as is and create another issue but the design / implementation would probably benefit from being able to handle this generically, what do you think ?
I think adding in checks for more complex blocks that use a def i_return_float_2(*args):
return 2.0
value = 1
value3 = 2
if value < i_return_float_2(value3, True, False, 3, 5, 9):
value = i_return_float_2(value3, True, False, 3, 5, 9) Which I guess becomes trivial once I know that those nodes are I'll take a crack at it and try |
I guess a hacky way to make it work would be to call the |
Actually kind of like this idea. Might be able to escape the 'isinstance' ladder that is duplicated throughout that function. |
Matches on Call nodes Matches on BinaryOp nodes Update test cases to include positive matches and negatives
fix linting errors introduced by other changes on this branch
Added in the original false negatives, and some additional true negatives to the test cases. The addition of increasing scope of Took @Pierre-Sassoulas idea of using the Oh and if anyone can help me figure out how to fix the following 2 errors from the pylint pre-commit hook, I can fix the failing CI check that I have ************* Module script.create_contributor_list
script/create_contributor_list.py:7:0: E0401: Unable to import 'contributors_txt' (import-error)
************* Module pylint.reporters.text
pylint/reporters/text.py:232:16: E0401: Unable to import 'colorama' (import-error) |
You probably need to install the test requirements with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This look pretty good already, waiting for CI to be green and for another maintainer review before merging but this is definitely going into 3.1 !
tests/functional/a/access/access_attr_before_def_false_positive.py
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
Remove extra comment Install extra dependencies, pre-commit passing locally
Thanks doing this was able to resolve those issues for me locally, let's hope that passes in CI. |
This comment has been minimized.
This comment has been minimized.
π€ Effect of this PR on checked open source code: π€ Effect on home-assistant:
Effect on music21:
Effect on django:
Effect on pandas:
This comment was generated for commit aa77f4b |
We're going to release 3.1.0 this week-end let's merge π |
Congratulation on becoming a pylint contributor π |
Type of Changes
Description
Altered checks to account for statements written in the reverse order of an expected if block.
Closes #8947