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
Fix false positive for unnecessary-lambda
with kwargs in the call but not the lambda
#9149
Fix false positive for unnecessary-lambda
with kwargs in the call but not the lambda
#9149
Conversation
2a1c900
to
e3c0cc6
Compare
This comment has been minimized.
This comment has been minimized.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #9149 +/- ##
==========================================
+ Coverage 95.76% 95.78% +0.01%
==========================================
Files 173 173
Lines 18680 18675 -5
==========================================
- Hits 17889 17887 -2
+ Misses 791 788 -3
|
This comment has been minimized.
This comment has been minimized.
This simplifies the check for the call having kwargs but not the lambda.
1828b94
to
e5757d0
Compare
🤖 Effect of this PR on checked open source code: 🤖 Effect on pandas:
This comment was generated for commit e5757d0 |
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.
Thank you for opening an issue and fixing the problem directly ! Not only do the primers looks great, but also you simplified the code and actually removed more lines than you added even though you added a changelog and new tests. Great first contribution !
This simplifies the check for the call having kwargs but not the lambda. (cherry picked from commit 2289c71)
This simplifies the check for the call having kwargs but not the lambda. (cherry picked from commit 2289c71) Co-authored-by: Clément Schreiner <clement@mux.me>
I might have missed something because I don't understand why
call_site.keyword_arguments
has been used here instead of simply comparingnode.args.kwarg
withcall.keywords
. Maybe this is not the right way to fix the issue.As far as I can tell,
lambda_kwargs
here is always empty because of this condition at the beginning of the checkAlso,
call_site.keyword_arguments
is empty in the case of the example I added to the tests, with causes the false positive.Type of Changes
Description
Closes #9148