summaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
authorTorsten Marek <tmarek@google.com>2013-06-18 15:06:28 +0200
committerTorsten Marek <tmarek@google.com>2013-06-18 15:06:28 +0200
commit2b172ad79b66ff7c0ae257bb23bc67f89b80c6bf (patch)
treec32fa9250e05543d51260b151fd2c2d13a695b37 /utils.py
parente9dd580d018bf78b96a4fe20e6018ff0cf812ed2 (diff)
downloadpylint-git-2b172ad79b66ff7c0ae257bb23bc67f89b80c6bf.tar.gz
Allow messages to be added by symbolic name as well as by ID.
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/utils.py b/utils.py
index 86b0417ef..ccab4d1c7 100644
--- a/utils.py
+++ b/utils.py
@@ -345,15 +345,17 @@ class MessagesHandlerMixIn(object):
except KeyError:
pass
- def add_message(self, msgid, line=None, node=None, args=None):
- """add the message corresponding to the given id.
+ def add_message(self, msg_descr, line=None, node=None, args=None):
+ """Adds a message given by ID or name.
- If provided, msg is expanded using args
+ If provided, the message string is expanded using args
- astroid checkers should provide the node argument, raw checkers should
- provide the line argument.
+ AST checkers should must the node argument (but may optionally
+ provide line if the line number is different), raw and token checkers
+ must provide the line argument.
"""
- msg_info = self._messages[msgid]
+ msg_info = self.check_message_id(msg_descr)
+ msgid = msg_info.msgid
# Fatal messages and reports are special, the node/scope distinction
# does not apply to them.
if msgid[0] not in _SCOPE_EXEMPT: