summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJason Lau <github.com@dotkr.nl>2023-04-26 02:19:14 +0000
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2023-05-03 22:01:26 +0200
commitca74a1dbdabc138559d267e3adfef3893a1e795a (patch)
treea39494820483b8d450393d3883e4eb837c8621ca /doc
parentdbe9f88189d57530e2383f3127045ba29a678e8b (diff)
downloadpylint-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 'doc')
-rw-r--r--doc/user_guide/checkers/features.rst8
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/user_guide/checkers/features.rst b/doc/user_guide/checkers/features.rst
index 789d59b8b..ec6d11c2d 100644
--- a/doc/user_guide/checkers/features.rst
+++ b/doc/user_guide/checkers/features.rst
@@ -893,14 +893,14 @@ Refactoring checker Messages
Emitted when a single "return" or "return None" statement is found at the end
of function or method definition. This statement can safely be removed
because Python will implicitly return None
-:use-implicit-booleaness-not-comparison-to-zero (C1805): *"%s" can be simplified to "%s" as 0 is falsey*
- Used when Pylint detects comparison to a 0 constant.
-:use-implicit-booleaness-not-comparison-to-string (C1804): *"%s" can be simplified to "%s" as an empty string is falsey*
+:use-implicit-booleaness-not-comparison-to-string (C1804): *"%s" can be simplified to "%s", if it is striclty a string, as an empty string is falsey*
Used when Pylint detects comparison to an empty string constant.
-:use-implicit-booleaness-not-comparison (C1803): *'%s' can be simplified to '%s' as an empty %s is falsey*
+:use-implicit-booleaness-not-comparison (C1803): *"%s" can be simplified to "%s", if it is strictly a sequence, as an empty %s is falsey*
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
+:use-implicit-booleaness-not-comparison-to-zero (C1805): *"%s" can be simplified to "%s", if it is strictly an int, as 0 is falsey*
+ Used when Pylint detects comparison to a 0 constant.
:unneeded-not (C0113): *Consider changing "%s" to "%s"*
Used when a boolean expression contains an unneeded negation.
:consider-iterating-dictionary (C0201): *Consider iterating the dictionary directly instead of calling .keys()*