diff options
author | cpopa <devnull@localhost> | 2014-09-10 20:52:22 +0300 |
---|---|---|
committer | cpopa <devnull@localhost> | 2014-09-10 20:52:22 +0300 |
commit | 0d70ddbc67b62c3f2bd536c48318f32ae9fa2c0e (patch) | |
tree | 121753a4d7b2919a2715f0e8e80a7c71d2172488 /checkers/variables.py | |
parent | 783b2bab2cef43c099778b8616f50a0fa5cc2073 (diff) | |
download | pylint-0d70ddbc67b62c3f2bd536c48318f32ae9fa2c0e.tar.gz |
Allow the customisation of callback identifiers. Closes issue #326.
Diffstat (limited to 'checkers/variables.py')
-rw-r--r-- | checkers/variables.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/checkers/variables.py b/checkers/variables.py index 12a26ad..df39f10 100644 --- a/checkers/variables.py +++ b/checkers/variables.py @@ -287,6 +287,13 @@ variables (i.e. expectedly not used).'}), 'help' : 'List of additional names supposed to be defined in \ builtins. Remember that you should avoid to define new builtins when possible.' }), + ("callbacks", + {'default' : ('cb_', '_cb'), 'type' : 'csv', + 'metavar' : '<callbacks>', + 'help' : 'List of strings which can identify a callback ' + 'function by name. A callback name must start or ' + 'end with one of those strings.'} + ) ) def __init__(self, linter=None): BaseChecker.__init__(self, linter) @@ -545,8 +552,9 @@ builtins. Remember that you should avoid to define new builtins when possible.' continue 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'): + # don't check callback arguments + if any(node.name.startswith(cb) or node.name.endswith(cb) + for cb in self.config.callbacks): continue self.add_message('unused-argument', args=name, node=stmt, confidence=confidence) |