summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <cpopa@cloudbasesolutions.com>2014-11-15 18:31:38 +0200
committerClaudiu Popa <cpopa@cloudbasesolutions.com>2014-11-15 18:31:38 +0200
commitab3c63be3d659c8f5c7654dbdfd88dd6718af47f (patch)
tree300bf41ca36d22c7fec1a6817ca83a837f67fc49
parentf409292f746f3532042b074d9454822b9fb2c329 (diff)
downloadpylint-ab3c63be3d659c8f5c7654dbdfd88dd6718af47f.tar.gz
Move backtick warning in python3 porting checker.
-rw-r--r--checkers/format.py9
-rw-r--r--checkers/python3.py12
-rw-r--r--test/messages/func_backtick_deprecated_py_30.txt2
3 files changed, 13 insertions, 10 deletions
diff --git a/checkers/format.py b/checkers/format.py
index 813130b..fe220b1 100644
--- a/checkers/format.py
+++ b/checkers/format.py
@@ -116,11 +116,6 @@ MSGS = {
'should use a upper case "L" since the letter "l" looks too much '
'like the digit "1"',
{'maxversion': (3, 0)}),
- 'W0333': ('Use of the `` operator',
- 'backtick',
- 'Used when the deprecated "``" (backtick) operator is used '
- 'instead of the str() function.',
- {'scope': WarningScope.NODE, 'maxversion': (3, 0)}),
'C0327': ('Mixed line endings LF and CRLF',
'mixed-line-endings',
'Used when there are mixed (LF and CRLF) newline signs in a file.'),
@@ -919,10 +914,6 @@ class FormatChecker(BaseTokenChecker):
self.add_message('multiple-statements', node=node)
self._visited_lines[line] = 2
- @check_messages('backtick')
- def visit_backquote(self, node):
- self.add_message('backtick', node=node)
-
def check_lines(self, lines, i):
"""check lines have less than a maximum number of characters
"""
diff --git a/checkers/python3.py b/checkers/python3.py
index e8609a0..d83709f 100644
--- a/checkers/python3.py
+++ b/checkers/python3.py
@@ -18,6 +18,7 @@ import tokenize
import astroid
from pylint import checkers, interfaces
+from pylint.utils import WarningScope
from pylint.checkers import utils
def _check_dict_node(node):
@@ -67,6 +68,13 @@ class Python3Checker(checkers.BaseChecker):
"instead of 'raise foo(bar)'.",
{'maxversion': (3, 0),
'old_names': [('W0121', 'old-raise-syntax')]}),
+ 'E1606': ('Use of the `` operator',
+ 'backtick',
+ 'Used when the deprecated "``" (backtick) operator is used '
+ 'instead of the str() function.',
+ {'scope': WarningScope.NODE,
+ 'maxversion': (3, 0),
+ 'old_names': [('W0333', 'backtick')]}),
'W1601': ('apply built-in referenced',
'apply-builtin',
'Used when the apply built-in function is referenced '
@@ -316,6 +324,10 @@ class Python3Checker(checkers.BaseChecker):
if isinstance(node.name, (astroid.Tuple, astroid.List)):
self.add_message('unpacking-in-except', node=node)
+ @utils.check_messages('backtick')
+ def visit_backquote(self, node):
+ self.add_message('backtick', node=node)
+
@utils.check_messages('raising-string', 'old-raise-syntax')
def visit_raise(self, node):
"""Visit a raise statement and check for raising
diff --git a/test/messages/func_backtick_deprecated_py_30.txt b/test/messages/func_backtick_deprecated_py_30.txt
index c78baa1..a4156f7 100644
--- a/test/messages/func_backtick_deprecated_py_30.txt
+++ b/test/messages/func_backtick_deprecated_py_30.txt
@@ -1,2 +1,2 @@
-W: 4: Use of the `` operator
+E: 4: Use of the `` operator