diff options
author | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2010-03-04 09:12:02 +0100 |
---|---|---|
committer | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2010-03-04 09:12:02 +0100 |
commit | ebb64fcf6f83eb12e7dd86467054d223922a56b0 (patch) | |
tree | 5c0ddb36fe9caa2359421e0f066c57e186601141 | |
parent | 44fc24c6f51f1a025960cfb1dd6272a599b93667 (diff) | |
download | pylint-git-ebb64fcf6f83eb12e7dd86467054d223922a56b0.tar.gz |
applied Colin Moris patch closing #9263: no W0613 for __init__ (method does not use all of its arguments)
-rw-r--r-- | checkers/variables.py | 2 | ||||
-rw-r--r-- | test/input/func_w0613.py | 10 | ||||
-rw-r--r-- | test/messages/func_w0613.txt | 1 |
3 files changed, 11 insertions, 2 deletions
diff --git a/checkers/variables.py b/checkers/variables.py index b52581c64..e7b7fd56e 100644 --- a/checkers/variables.py +++ b/checkers/variables.py @@ -240,7 +240,7 @@ builtins. Remember that you should avoid to define new builtins when possible.' overridden = overridden_method(klass, node.name) if overridden is not None and name in overridden.argnames(): continue - if node.name in PYMETHODS: + if node.name in PYMETHODS and node.name not in ('__init__', '__new__'): continue # don't check callback arguments XXX should be configurable if node.name.startswith('cb_') or node.name.endswith('_cb'): diff --git a/test/input/func_w0613.py b/test/input/func_w0613.py index 3bf57674d..0573714cf 100644 --- a/test/input/func_w0613.py +++ b/test/input/func_w0613.py @@ -22,7 +22,7 @@ class AAAA: """called by the registry when the vobject has been selected. """ return cls - + def using_inner_function(self, etype, size=1): """return a fake result set for a particular entity type""" rset = AAAA([('A',)]*size, '%s X' % etype, @@ -33,3 +33,11 @@ class AAAA: return req.vreg.etype_class(etype)(req, rset, row, col) # pylint: disable-msg = W0201 rset.get_entity = inner + +class BBBB: + """dummy class""" + + def __init__(self, arg): + """Constructor with an extra parameter. Should raise a warning""" + self.spam = 1 + diff --git a/test/messages/func_w0613.txt b/test/messages/func_w0613.txt index 34ac066a3..36cb38014 100644 --- a/test/messages/func_w0613.txt +++ b/test/messages/func_w0613.txt @@ -2,3 +2,4 @@ W: 7:function: Unused argument 'arg' W: 14:AAAA.method: Unused argument 'arg' W: 21:AAAA.selected: Unused argument 'args' W: 21:AAAA.selected: Unused argument 'kwargs' +W: 40:BBBB.__init__: Unused argument 'arg' |