diff options
author | tmarek <tmarek@google.com> | 2013-02-20 11:25:08 +0100 |
---|---|---|
committer | tmarek <tmarek@google.com> | 2013-02-20 11:25:08 +0100 |
commit | 8b8f6e45a87062a37fe8023f4cdd2cbd2c007580 (patch) | |
tree | 74e154f3b1537bf193bc58037e94095984cc8c29 | |
parent | 8111a29f0b606367b02704e65678818977ac9cb0 (diff) | |
download | pylint-8b8f6e45a87062a37fe8023f4cdd2cbd2c007580.tar.gz |
Two small fixes for suppression warnings I00{2,1}:
- make sure to include the full message name (with symbol, if requested) in the output
- flush I002{0,1} warnings after each module, not after complete run
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | lint.py | 8 | ||||
-rw-r--r-- | utils.py | 11 |
3 files changed, 19 insertions, 3 deletions
@@ -43,6 +43,9 @@ ChangeLog for PyLint * #112698: fixed crashes related to non-inferable __all__ attributes and invalid __all__ contents (patch by Torsten Marek) + * Include full warning id for I0020 and I0021 and make sure to flush + warnings after each module, not at the end of the pylint run. + (patch by Torsten Marek) 2012-10-05 -- 0.26.0 * #106534: add --ignore-imports option to code similarity checking @@ -585,6 +585,7 @@ This is used by the global evaluation report (RP0004).'}), # if it's actually a c extension) self.current_file = astng.file self.check_astng_module(astng, walker, rawcheckers) + self._add_suppression_messages() # notify global end self.set_current_module('') self.stats['statement'] = walker.nbstatements @@ -680,7 +681,6 @@ This is used by the global evaluation report (RP0004).'}), if persistent run, pickle results for later comparison """ - self._add_suppression_messages() if self.base_name is not None: # load previous results if any previous_stats = config.load_results(self.base_name) @@ -705,11 +705,13 @@ This is used by the global evaluation report (RP0004).'}), for warning, lines in self._raw_module_msgs_state.iteritems(): for line, enable in lines.iteritems(): if not enable and (warning, line) not in self._ignored_msgs: - self.add_message('I0021', line, None, (warning,)) + self.add_message('I0021', line, None, + (self.get_msg_display_string(warning),)) for (warning, from_), lines in self._ignored_msgs.iteritems(): for line in lines: - self.add_message('I0020', line, None, (warning, from_)) + self.add_message('I0020', line, None, + (self.get_msg_display_string(warning), from_)) def report_evaluation(self, sect, stats, previous_stats): """make the global evaluation report""" @@ -264,6 +264,17 @@ class MessagesHandlerMixIn: except KeyError: raise UnknownMessage('No such message id %s' % msgid) + def get_msg_display_string(self, msgid): + """Generates a user-consumable representation of a message. + + Can be just the message ID or the ID and the symbol. + """ + if self.config.symbols: + symbol = self.check_message_id(msg_id).symbol + if symbol: + msgid += '(%s)' % symbol + return msgid + def get_message_state_scope(self, msgid, line=None): """Returns the scope at which a message was enabled/disabled.""" try: |