summaryrefslogtreecommitdiff
path: root/doc/whatsnew/fragments/3670.false_positive
diff options
context:
space:
mode:
authorThéo Battrel <theo.util@protonmail.ch>2023-04-06 17:42:52 +0200
committerGitHub <noreply@github.com>2023-04-06 17:42:52 +0200
commit156da64d0fb4c06e15c5b619b91ce550d594a770 (patch)
tree30bf003979e4af1212746a2da015d52e1fbfb07c /doc/whatsnew/fragments/3670.false_positive
parent82cee3719df2c799cf5b94bf5fb8058c297bc607 (diff)
downloadpylint-git-156da64d0fb4c06e15c5b619b91ce550d594a770.tar.gz
Fix check unused arguments false positive bug (#8542)
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 https://github.com/pylint-dev/pylint/issues/3670
Diffstat (limited to 'doc/whatsnew/fragments/3670.false_positive')
-rw-r--r--doc/whatsnew/fragments/3670.false_positive3
1 files changed, 3 insertions, 0 deletions
diff --git a/doc/whatsnew/fragments/3670.false_positive b/doc/whatsnew/fragments/3670.false_positive
new file mode 100644
index 000000000..562a41de2
--- /dev/null
+++ b/doc/whatsnew/fragments/3670.false_positive
@@ -0,0 +1,3 @@
+Fix `unused-argument` false positive when `__new__` does not use all the arguments of `__init__`.
+
+Closes #3670