summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Marek <shlomme@gmail.com>2014-04-17 11:04:41 +0200
committerTorsten Marek <shlomme@gmail.com>2014-04-17 11:04:41 +0200
commit165f17bdb491dfb62eff8edc1956c0590758c33b (patch)
treeee7c859764521f404b12c63c983adaf6c03870ad
parent851fd3a32ecbf5c66a6bbd98c9f9103f24baa483 (diff)
downloadpylint-165f17bdb491dfb62eff8edc1956c0590758c33b.tar.gz
Only emit symbolic warnings from the logging checker.
-rw-r--r--checkers/logging.py10
-rw-r--r--test/test_logging.py6
2 files changed, 8 insertions, 8 deletions
diff --git a/checkers/logging.py b/checkers/logging.py
index dbd1e7b..cbdf0f2 100644
--- a/checkers/logging.py
+++ b/checkers/logging.py
@@ -149,7 +149,7 @@ class LoggingChecker(checkers.BaseChecker):
return
if isinstance(node.args[format_pos], astroid.BinOp) and node.args[format_pos].op == '%':
- self.add_message('W1201', node=node)
+ self.add_message('logging-not-lazy', node=node)
elif isinstance(node.args[format_pos], astroid.Const):
self._check_format_string(node, format_pos)
@@ -180,16 +180,16 @@ class LoggingChecker(checkers.BaseChecker):
return
except utils.UnsupportedFormatCharacter, ex:
char = format_string[ex.index]
- self.add_message('E1200', node=node,
+ self.add_message('logging-unsupported-format', node=node,
args=(char, ord(char), ex.index))
return
except utils.IncompleteFormatString:
- self.add_message('E1201', node=node)
+ self.add_message('logging-format-truncated', node=node)
return
if num_args > required_num_args:
- self.add_message('E1205', node=node)
+ self.add_message('logging-too-many-args', node=node)
elif num_args < required_num_args:
- self.add_message('E1206', node=node)
+ self.add_message('logging-too-few-args', node=node)
def _count_supplied_tokens(args):
diff --git a/test/test_logging.py b/test/test_logging.py
index fe7e638..cbacada 100644
--- a/test/test_logging.py
+++ b/test/test_logging.py
@@ -20,7 +20,7 @@ class LoggingModuleDetectionTest(CheckerTestCase):
""")
self.checker.visit_module(None)
self.checker.visit_import(stmts[0])
- with self.assertAddsMessages(Message('W1201', node=stmts[1])):
+ with self.assertAddsMessages(Message('logging-not-lazy', node=stmts[1])):
self.checker.visit_callfunc(stmts[1])
def test_detects_renamed_standard_logging_module(self):
@@ -30,7 +30,7 @@ class LoggingModuleDetectionTest(CheckerTestCase):
""")
self.checker.visit_module(None)
self.checker.visit_import(stmts[0])
- with self.assertAddsMessages(Message('W1201', node=stmts[1])):
+ with self.assertAddsMessages(Message('logging-not-lazy', node=stmts[1])):
self.checker.visit_callfunc(stmts[1])
@set_config(logging_modules=['logging', 'my.logging'])
@@ -41,7 +41,7 @@ class LoggingModuleDetectionTest(CheckerTestCase):
""")
self.checker.visit_module(None)
self.checker.visit_import(stmts[0])
- with self.assertAddsMessages(Message('W1201', node=stmts[1])):
+ with self.assertAddsMessages(Message('logging-not-lazy', node=stmts[1])):
self.checker.visit_callfunc(stmts[1])