From c0cb0716fc4cdf322ac2c216579c399a2d73087a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20M=C3=A9dioni?= Date: Tue, 27 Oct 2015 09:36:29 +0100 Subject: improve unneeded-not messages - warning => convention - "One not too many" => "consider changing.." --- pylint/checkers/base.py | 4 ++-- pylint/test/functional/unneeded_not.txt | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py index e8a43969c..75a4d7f89 100644 --- a/pylint/checkers/base.py +++ b/pylint/checkers/base.py @@ -1844,12 +1844,12 @@ class ElifChecker(BaseTokenChecker): self.config.max_nested_blocks)) class NotChecker(_BasicChecker): - """checks for nots too many in comparison expressions + """checks for too many not in comparison expressions - "not not" should trigger a warning - "not" followed by a comparison should trigger a warning """ - msgs = {'W0126': ('One not too many in "%s", should be "%s"', + msgs = {'C0113': ('Consider changing "%s" to "%s"', 'unneeded-not', 'Used when a boolean expression contains an unneeded ' 'negation.'), diff --git a/pylint/test/functional/unneeded_not.txt b/pylint/test/functional/unneeded_not.txt index 83100a413..cf2761801 100644 --- a/pylint/test/functional/unneeded_not.txt +++ b/pylint/test/functional/unneeded_not.txt @@ -1,12 +1,12 @@ -unneeded-not:10:unneeded_not:One not too many in "not not bool_var", should be "bool_var" -unneeded-not:12:unneeded_not:One not too many in "not someint == 1", should be "someint != 1" -unneeded-not:14:unneeded_not:One not too many in "not someint != 1", should be "someint == 1" -unneeded-not:16:unneeded_not:One not too many in "not someint < 1", should be "someint >= 1" -unneeded-not:18:unneeded_not:One not too many in "not someint > 1", should be "someint <= 1" -unneeded-not:20:unneeded_not:One not too many in "not someint <= 1", should be "someint > 1" -unneeded-not:22:unneeded_not:One not too many in "not someint >= 1", should be "someint < 1" -unneeded-not:24:unneeded_not:One not too many in "not not someint", should be "someint" -unneeded-not:26:unneeded_not:One not too many in "not bool_var == True", should be "bool_var != True" -unneeded-not:28:unneeded_not:One not too many in "not bool_var == False", should be "bool_var != False" -unneeded-not:30:unneeded_not:One not too many in "not bool_var != True", should be "bool_var == True" -unneeded-not:32:unneeded_not:One not too many in "not True == True", should be "True != True" +unneeded-not:10:unneeded_not:Consider changing "not not bool_var" to "bool_var" +unneeded-not:12:unneeded_not:Consider changing "not someint == 1" to "someint != 1" +unneeded-not:14:unneeded_not:Consider changing "not someint != 1" to "someint == 1" +unneeded-not:16:unneeded_not:Consider changing "not someint < 1" to "someint >= 1" +unneeded-not:18:unneeded_not:Consider changing "not someint > 1" to "someint <= 1" +unneeded-not:20:unneeded_not:Consider changing "not someint <= 1" to "someint > 1" +unneeded-not:22:unneeded_not:Consider changing "not someint >= 1" to "someint < 1" +unneeded-not:24:unneeded_not:Consider changing "not not someint" to "someint" +unneeded-not:26:unneeded_not:Consider changing "not bool_var == True" to "bool_var != True" +unneeded-not:28:unneeded_not:Consider changing "not bool_var == False" to "bool_var != False" +unneeded-not:30:unneeded_not:Consider changing "not bool_var != True" to "bool_var == True" +unneeded-not:32:unneeded_not:Consider changing "not True == True" to "True != True" -- cgit v1.2.1