Fix false positive for unnecessary-lambda with kwargs in the call but not the lambda#9149
Merged
Pierre-Sassoulas merged 1 commit intopylint-dev:mainfrom Oct 29, 2023
Merged
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
Contributor
|
🤖 Effect of this PR on checked open source code: 🤖 Effect on pandas: Details
This comment was generated for commit e5757d0 |
Pierre-Sassoulas
approved these changes
Oct 29, 2023
Member
Pierre-Sassoulas
left a comment
There was a problem hiding this comment.
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 !
github-actions Bot
pushed a commit
that referenced
this pull request
Oct 29, 2023
This simplifies the check for the call having kwargs but not the lambda. (cherry picked from commit 2289c71)
Pierre-Sassoulas
pushed a commit
that referenced
this pull request
Oct 29, 2023
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I might have missed something because I don't understand why
call_site.keyword_argumentshas been used here instead of simply comparingnode.args.kwargwithcall.keywords. Maybe this is not the right way to fix the issue.As far as I can tell,
lambda_kwargshere is always empty because of this condition at the beginning of the checkAlso,
call_site.keyword_argumentsis empty in the case of the example I added to the tests, with causes the false positive.Type of Changes
Description
Closes #9148