diff options
Diffstat (limited to 'reporters/text.py')
-rw-r--r-- | reporters/text.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/reporters/text.py b/reporters/text.py index 04245f7..48b5155 100644 --- a/reporters/text.py +++ b/reporters/text.py @@ -23,7 +23,7 @@ from logilab.common.ureports import TextWriter from logilab.common.textutils import colorize_ansi from pylint.interfaces import IReporter -from pylint.reporters import BaseReporter, Message +from pylint.reporters import BaseReporter TITLE_UNDERLINES = ['', '=', '-', '.'] @@ -48,16 +48,15 @@ class TextReporter(BaseReporter): """Convenience method to write a formated message with class default template""" self.writeln(msg.format(self._template)) - def add_message(self, msg_id, location, msg): + def handle_message(self, msg): """manage message of different type and in the context of path""" - m = Message(self, msg_id, location, msg) - if m.module not in self._modules: - if m.module: - self.writeln('************* Module %s' % m.module) - self._modules.add(m.module) + if msg.module not in self._modules: + if msg.module: + self.writeln('************* Module %s' % msg.module) + self._modules.add(msg.module) else: self.writeln('************* ') - self.write_message(m) + self.write_message(msg) def _display(self, layout): """launch layouts display""" @@ -114,11 +113,10 @@ class ColorizedTextReporter(TextReporter): except KeyError: return None, None - def add_message(self, msg_id, location, msg): + def handle_message(self, msg): """manage message of different types, and colorize output using ansi escape codes """ - msg = Message(self, msg_id, location, msg) if msg.module not in self._modules: color, style = self._get_decoration('S') if msg.module: @@ -130,8 +128,10 @@ class ColorizedTextReporter(TextReporter): self.writeln(modsep) self._modules.add(msg.module) color, style = self._get_decoration(msg.C) - for attr in ('msg', 'symbol', 'category', 'C'): - setattr(msg, attr, colorize_ansi(getattr(msg, attr), color, style)) + + msg = msg._replace( + **{attr: colorize_ansi(getattr(msg, attr), color, style) + for attr in ('msg', 'symbol', 'category', 'C')}) self.write_message(msg) |