diff --git a/checkers/logging.py b/checkers/logging.py index dbd1e7bef..cbdf0f2a0 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 fe7e63819..cbacada00 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])