-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix check unused arguments false positive bug #8542
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 check unused arguments false positive bug #8542
Conversation
3411d52
to
64a5d0a
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #8542 +/- ##
=======================================
Coverage 95.90% 95.90%
=======================================
Files 174 174
Lines 18353 18361 +8
=======================================
+ Hits 17602 17610 +8
Misses 751 751
|
64a5d0a
to
f9ef291
Compare
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 working on this, the primer results look pretty good ! Could you also add a functional tests, please ?
f9ef291
to
3dec21f
Compare
Rebased to fix failing primer tests and added a test as requested. |
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 ! Could you also add a fragment for the changelog, please ?
a82ed13
to
0418188
Compare
Rebased to include the changelog fragment into the first commit. |
Problem: the special method `__new__` must match the arguments of the `__init__` method even if `__new__` method does not use them. This generate `unused-argument` for the `__new__` method. Fix: the unused arguments check should not be done on the `__new__` method if the `__init__` method is defined in the same class. Fixes pylint-dev#3670
Update `unused-argument` test to include a check for the case of `__init__` and `__new__` being defined in a class but `__new__` does not use all of the argument. This is fine because `__new__` must have the same argument of `__init__`. Update with a second check in case of `__init__` being not defined in a class. Then the unused arguments check must be done on `__new__`.
3417c49
to
66ee6a6
Compare
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.
Great first contribution !
Problem: the special method `__new__` must match the arguments of the `__init__` method even if `__new__` method does not use them. This generate `unused-argument` for the `__new__` method. Fix: the unused arguments check should not be done on the `__new__` method if the `__init__` method is defined in the same class. Update `unused-argument` test to include a check for the case of `__init__` and `__new__` being defined in a class but `__new__` does not use all of the argument. This is fine because `__new__` must have the same argument of `__init__`. Update with a second check in case of `__init__` being not defined in a class. Then the unused arguments check must be done on `__new__`. Fixes #3670 (cherry picked from commit 156da64)
Problem: the special method `__new__` must match the arguments of the `__init__` method even if `__new__` method does not use them. This generate `unused-argument` for the `__new__` method. Fix: the unused arguments check should not be done on the `__new__` method if the `__init__` method is defined in the same class. Update `unused-argument` test to include a check for the case of `__init__` and `__new__` being defined in a class but `__new__` does not use all of the argument. This is fine because `__new__` must have the same argument of `__init__`. Update with a second check in case of `__init__` being not defined in a class. Then the unused arguments check must be done on `__new__`. Fixes #3670 (cherry picked from commit 156da64) Co-authored-by: Théo Battrel <theo.util@protonmail.ch>
Type of Changes
Description
Problem: the special method
__new__
must match the arguments of the__init__
method even if__new__
method does not use them. This generateunused-argument
for the__new__
method.Fix: the unused arguments check should not be done on the
__new__
method if the__init__
method is defined in the same class.Closes #3670