From 165f17bdb491dfb62eff8edc1956c0590758c33b Mon Sep 17 00:00:00 2001 From: Torsten Marek Date: Thu, 17 Apr 2014 11:04:41 +0200 Subject: Only emit symbolic warnings from the logging checker. --- checkers/logging.py | 10 +++++----- test/test_logging.py | 6 +++--- 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]) -- cgit v1.2.1