From ca74a1dbdabc138559d267e3adfef3893a1e795a Mon Sep 17 00:00:00 2001 From: Jason Lau Date: Wed, 26 Apr 2023 02:19:14 +0000 Subject: Add applicability notes for `compare-to-empty-string/zero` (#8592) The extension `compare-to-empty-string` is only applicable when the expression being compared is strictly a `str`. The extension `compare-to-zero` is only applicable when the expression being compared is strictly an `int`. --- pylint/checkers/refactoring/implicit_booleaness_checker.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pylint') diff --git a/pylint/checkers/refactoring/implicit_booleaness_checker.py b/pylint/checkers/refactoring/implicit_booleaness_checker.py index 3f7bddb1b..d3ef542a1 100644 --- a/pylint/checkers/refactoring/implicit_booleaness_checker.py +++ b/pylint/checkers/refactoring/implicit_booleaness_checker.py @@ -74,14 +74,14 @@ class ImplicitBooleanessChecker(checkers.BaseChecker): {"old_names": [("C1801", "len-as-condition")]}, ), "C1803": ( - '"%s" can be simplified to "%s" as an empty %s is falsey', + '"%s" can be simplified to "%s", if it is strictly a sequence, as an empty %s is falsey', "use-implicit-booleaness-not-comparison", "Used when Pylint detects that collection literal comparison is being " "used to check for emptiness; Use implicit booleaness instead " "of a collection classes; empty collections are considered as false", ), "C1804": ( - '"%s" can be simplified to "%s" as an empty string is falsey', + '"%s" can be simplified to "%s", if it is striclty a string, as an empty string is falsey', "use-implicit-booleaness-not-comparison-to-string", "Used when Pylint detects comparison to an empty string constant.", { @@ -90,7 +90,7 @@ class ImplicitBooleanessChecker(checkers.BaseChecker): }, ), "C1805": ( - '"%s" can be simplified to "%s" as 0 is falsey', + '"%s" can be simplified to "%s", if it is strictly an int, as 0 is falsey', "use-implicit-booleaness-not-comparison-to-zero", "Used when Pylint detects comparison to a 0 constant.", {"default_enabled": False, "old_names": [("C2001", "compare-to-zero")]}, -- cgit v1.2.1