summaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2014-10-16 14:22:06 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2014-10-16 14:22:06 +0300
commit11ed19d3cfd4574dba17554e8ec27999a1578d05 (patch)
tree845c2f3b6a050548b6ece583eb6e03b21701c291 /utils.py
parent69672965cabf5f31d3f17c2095ba9685deafb0a8 (diff)
parent9851fe59dc2b3abb7e30af69f6d6c1d40419c7b9 (diff)
downloadpylint-11ed19d3cfd4574dba17554e8ec27999a1578d05.tar.gz
Fix a regression, where '{path}' was no longer accepted in '--msg-template'.
Patch by LCD47.
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/utils.py b/utils.py
index 36194b7..7c22b73 100644
--- a/utils.py
+++ b/utils.py
@@ -84,7 +84,7 @@ class WarningScope(object):
_MsgBase = collections.namedtuple(
'_MsgBase',
['msg_id', 'symbol', 'msg', 'C', 'category', 'confidence',
- 'abspath', 'module', 'obj', 'line', 'column'])
+ 'abspath', 'path', 'module', 'obj', 'line', 'column'])
class Message(_MsgBase):
@@ -95,7 +95,13 @@ class Message(_MsgBase):
confidence, *location)
def get_init_args(self):
- location = (self.abspath, self.module, self.obj, self.line, self.column)
+ location = (
+ self.abspath,
+ self.path,
+ self.module,
+ self.obj,
+ self.line,
+ self.column)
return (self.msg_id, self.symbol, location, self.msg, self.confidence)
def format(self, template):
@@ -395,14 +401,15 @@ class MessagesHandlerMixIn(object):
# get module and object
if node is None:
module, obj = self.current_name, ''
- path = self.current_file
+ abspath = self.current_file
else:
module, obj = get_module_and_frameid(node)
- path = node.root().file
+ abspath = node.root().file
+ path = abspath.replace(self.reporter.path_strip_prefix, '')
# add the message
self.reporter.handle_message(
Message(msgid, symbol,
- (path, module, obj, line or 1, col_offset or 0), msg, confidence))
+ (abspath, path, module, obj, line or 1, col_offset or 0), msg, confidence))
def print_full_documentation(self):
"""output a full documentation in ReST format"""