diff options
author | Jason Lau <github.com@dotkr.nl> | 2023-04-26 02:19:14 +0000 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-05-03 22:01:26 +0200 |
commit | ca74a1dbdabc138559d267e3adfef3893a1e795a (patch) | |
tree | a39494820483b8d450393d3883e4eb837c8621ca /pylint/checkers/refactoring | |
parent | dbe9f88189d57530e2383f3127045ba29a678e8b (diff) | |
download | pylint-git-ca74a1dbdabc138559d267e3adfef3893a1e795a.tar.gz |
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`.
Diffstat (limited to 'pylint/checkers/refactoring')
-rw-r--r-- | pylint/checkers/refactoring/implicit_booleaness_checker.py | 6 |
1 files changed, 3 insertions, 3 deletions
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")]}, |