summaryrefslogtreecommitdiff
path: root/reporters/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'reporters/__init__.py')
-rw-r--r--reporters/__init__.py37
1 files changed, 9 insertions, 28 deletions
diff --git a/reporters/__init__.py b/reporters/__init__.py
index 12d193f..429155a 100644
--- a/reporters/__init__.py
+++ b/reporters/__init__.py
@@ -17,7 +17,6 @@ import sys
import locale
import os
-from pylint.utils import MSG_TYPES
from pylint import utils
@@ -28,10 +27,6 @@ if sys.version_info >= (3, 0):
def cmp(a, b):
return (a > b) - (a < b)
-if sys.version_info < (2, 6):
- import stringformat
- stringformat.init(True)
-
def diff_string(old, new):
"""given a old and new int value, return a string representing the
difference
@@ -41,27 +36,6 @@ def diff_string(old, new):
return diff_str
-class Message(object):
- """This class represent a message to be issued by the reporters"""
-
- def __init__(self, reporter, msg_id, location, msg):
- self.msg_id = msg_id
- self.abspath, self.module, self.obj, self.line, self.column = location
- self.path = self.abspath.replace(reporter.path_strip_prefix, '')
- self.msg = msg
- self.C = msg_id[0]
- self.category = MSG_TYPES[msg_id[0]]
- self.symbol = reporter.linter.msgs_store.check_message_id(msg_id).symbol
-
- def format(self, template):
- """Format the message according to the given template.
-
- The template format is the one of the format method :
- cf. http://docs.python.org/2/library/string.html#formatstrings
- """
- return template.format(**(self.__dict__))
-
-
class BaseReporter(object):
"""base class for reporters
@@ -82,9 +56,16 @@ class BaseReporter(object):
# Build the path prefix to strip to get relative paths
self.path_strip_prefix = os.getcwd() + os.sep
+ def handle_message(self, msg):
+ """Handle a new message triggered on the current file.
+
+ Invokes the legacy add_message API by default."""
+ self.add_message(
+ msg.msg_id, (msg.abspath, msg.module, msg.obj, msg.line, msg.column),
+ msg.msg)
+
def add_message(self, msg_id, location, msg):
- """Client API to send a message"""
- # Shall we store the message objects somewhere, do some validity checking ?
+ """Deprecated, do not use."""
raise NotImplementedError
def set_output(self, output=None):