summaryrefslogtreecommitdiff
path: root/pylint/checkers/base.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2015-10-26 16:39:53 +0000
committerClaudiu Popa <pcmanticore@gmail.com>2015-10-26 16:39:53 +0000
commit5ec61312c563df13c29e67dc5cb3e003f8f492f6 (patch)
tree8258b34f6154e59e594410ab8fb45b3e5fcc2fca /pylint/checkers/base.py
parent516dfd89d2ee8aca773cd09e71a608354100debc (diff)
downloadpylint-5ec61312c563df13c29e67dc5cb3e003f8f492f6.tar.gz
Use the representation of the context when building the message for misplaced-comparison-constant.
Diffstat (limited to 'pylint/checkers/base.py')
-rw-r--r--pylint/checkers/base.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py
index fd3f285..cd4a81e 100644
--- a/pylint/checkers/base.py
+++ b/pylint/checkers/base.py
@@ -1494,7 +1494,7 @@ class ComparisonChecker(_BasicChecker):
if isinstance(right, astroid.Const):
return
operator = REVERSED_COMPS.get(operator, operator)
- suggestion = '%s %s %s' % (right.as_string(), operator, left.value)
+ suggestion = '%s %s %r' % (right.as_string(), operator, left.value)
self.add_message('misplaced-comparison-constant', node=node,
args=(suggestion,))
@@ -1504,7 +1504,6 @@ class ComparisonChecker(_BasicChecker):
# but not 'x == y == 42'
if len(node.ops) != 1:
return
-
left = node.left
operator, right = node.ops[0]
if operator == '==':