summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2011-01-06 10:49:14 +0100
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2011-01-06 10:49:14 +0100
commit30c5da98a1fd839c226b566b40fcf898f900a77a (patch)
tree47e3c8d79234552169b1739d07c132a7fb0b2fbd
parent7211e22da15094c0117b201ebf44f0dff438db90 (diff)
downloadpylint-30c5da98a1fd839c226b566b40fcf898f900a77a.tar.gz
avoid W0221 or W0222 when *args and **kwargs are in use. Patch by Charles Duffy.
-rw-r--r--ChangeLog14
-rw-r--r--checkers/classes.py3
-rw-r--r--test/input/func_noerror_overriden_method_varargs.py19
3 files changed, 31 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index b83a819..9c76678 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,18 +1,22 @@
ChangeLog for PyLint
====================
-2010-12-16 -- 0.23.0
+ --
- * documentation: update, add manpages
- * performance: several improvements
- * python3: finalize python3 support
+ * documentation update, add manpages
- * W0106: new warning 'Expression "%s" is assigned to nothing'
+ * several performance improvements
+
+ * finalize python3 support
+
+ * new W0106 warning 'Expression "%s" is assigned to nothing'
* drop E0501 and E0502 messages about wrong source encoding: not anymore
interesting since it's a syntax error for python >= 2.5 and we now only
support this python version and above.
+ * don't emit W0221 or W0222 when methods as variable arguments (eg *arg
+ and/or **args). Patch submitted by Charles Duffy.
2010-11-15 -- 0.22.0
diff --git a/checkers/classes.py b/checkers/classes.py
index 909316a..856bad2 100644
--- a/checkers/classes.py
+++ b/checkers/classes.py
@@ -503,6 +503,9 @@ instance attributes.'}
# don't care about functions with unknown argument (builtins)
if method1.args.args is None or refmethod.args.args is None:
return
+ # if we use *args, **kwargs, skip the below checks
+ if method1.args.vararg or method1.args.kwarg:
+ return
if len(method1.args.args) != len(refmethod.args.args):
self.add_message('W0221', args=class_type, node=method1)
elif len(method1.args.defaults) < len(refmethod.args.defaults):
diff --git a/test/input/func_noerror_overriden_method_varargs.py b/test/input/func_noerror_overriden_method_varargs.py
new file mode 100644
index 0000000..afe3086
--- /dev/null
+++ b/test/input/func_noerror_overriden_method_varargs.py
@@ -0,0 +1,19 @@
+# pylint: disable=R0201,R0903
+"""docstring"""
+
+__revision__ = 1
+
+class SuperClass(object):
+ """docstring"""
+ def impl(self, arg1, arg2):
+ """docstring"""
+ return arg1 + arg2
+
+class MyClass(SuperClass):
+ """docstring"""
+ def impl(self, *args, **kwargs):
+ """docstring"""
+ # ...do stuff here...
+ super(MyClass, self).impl(*args, **kwargs)
+
+# ...do stuff here...