diff options
| author | Damien Nozay <damien.nozay@gmail.com> | 2014-01-14 11:38:49 -0800 |
|---|---|---|
| committer | Damien Nozay <damien.nozay@gmail.com> | 2014-01-14 11:38:49 -0800 |
| commit | fe8056767b6307475b3f69fe2aa339dd57a859da (patch) | |
| tree | 80f7fd265839fec6100ab2fa12983f5f4c4995da /utils.py | |
| parent | 95ea13728665cc961aacc3a23d57aeffc3e3b528 (diff) | |
| download | pylint-git-fe8056767b6307475b3f69fe2aa339dd57a859da.tar.gz | |
fix error with message reports when custom checker uses old-style messages
when register_messages is called, it allows messages that are in the form
of 2-tuples, which means a symbol is not necessary. however, when doing
report_message_stats is called, it does not handle the case where there is
no symbol.
solution: when collecting message, use the message id as the key if the
symbol is None.
e.g.
```
Messages
--------
+------------------+------------+
|message id |occurrences |
+==================+============+
|missing-docstring |6 |
+------------------+------------+
|W9901 |4 |
+------------------+------------+
|invalid-name |1 |
+------------------+------------+
```
Diffstat (limited to 'utils.py')
| -rw-r--r-- | utils.py | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -400,6 +400,8 @@ class MessagesHandlerMixIn(object): """ msg_info = self.check_message_id(msg_descr) msgid = msg_info.msgid + # backward compatibility, message may not have a symbol + symbol = msg_info.symbol or msgid # Fatal messages and reports are special, the node/scope distinction # does not apply to them. if msgid[0] not in _SCOPE_EXEMPT: @@ -427,9 +429,9 @@ class MessagesHandlerMixIn(object): self.stats[msg_cat] += 1 self.stats['by_module'][self.current_name][msg_cat] += 1 try: - self.stats['by_msg'][msg_info.symbol] += 1 + self.stats['by_msg'][symbol] += 1 except KeyError: - self.stats['by_msg'][msg_info.symbol] = 1 + self.stats['by_msg'][symbol] = 1 # expand message ? msg = msg_info.msg if args: |
