diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-04-26 23:12:18 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-05-02 20:01:39 +0200 |
commit | 74ff4c59eb58453cb4e276610f63baa70ee402e1 (patch) | |
tree | 8a0d4a48b1f103aebe03ab37dd44b748901b5fa5 | |
parent | 918f4624d76197bec7cc54467f0281ff63c19c5a (diff) | |
download | pylint-git-74ff4c59eb58453cb4e276610f63baa70ee402e1.tar.gz |
[doc] Add warning for empty sequences in 'use-implicit-booleaness-not-comparison'
4 files changed, 17 insertions, 13 deletions
diff --git a/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/details.rst b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/details.rst index 257fb92bc..c5781b739 100644 --- a/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/details.rst +++ b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/details.rst @@ -1,3 +1,3 @@ Following this check blindly in weakly typed code base can create hard to debug issues. If the value -can be something else that is falsey but not a string (for example ``None``, or ``0``), the code will -not be equivalent. +can be something else that is falsey but not a string (for example ``None``, an empty sequence, or ``0``), +the code will not be equivalent. diff --git a/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/details.rst b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/details.rst index 670633b2a..2f86acf54 100644 --- a/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/details.rst +++ b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/details.rst @@ -1,3 +1,3 @@ Following this check blindly in weakly typed code base can create hard to debug issues. If the value -can be something else that is falsey but not an ``int`` (for example ``None``, or an empty string), -the code will not be equivalent. +can be something else that is falsey but not an ``int`` (for example ``None``, an empty sequence, +or an empty string), the code will not be equivalent. diff --git a/doc/data/messages/u/use-implicit-booleaness-not-comparison/details.rst b/doc/data/messages/u/use-implicit-booleaness-not-comparison/details.rst new file mode 100644 index 000000000..0dc180245 --- /dev/null +++ b/doc/data/messages/u/use-implicit-booleaness-not-comparison/details.rst @@ -0,0 +1,3 @@ +Following this check blindly in weakly typed code base can create hard to debug issues. If the value +can be something else that is falsey but not a sequence (for example ``None``, an empty string, or ``0``), +the code will not be equivalent. diff --git a/doc/whatsnew/fragments/6871.user_action b/doc/whatsnew/fragments/6871.user_action index e20983171..eace82f7a 100644 --- a/doc/whatsnew/fragments/6871.user_action +++ b/doc/whatsnew/fragments/6871.user_action @@ -1,12 +1,13 @@ -* The compare to empty string checker (``pylint.extensions.emptystring``) and the compare to - zero checker (``pylint.extensions.compare-to-zero``) have been removed and their checks are - now part of the implicit booleaness checker: - - - ``compare-to-zero`` was renamed ``use-implicit-booleaness-not-comparison-to-zero`` - and ``compare-to-empty-string`` was renamed ``use-implicit-booleaness-not-comparison-to-string`` - and they now need to be enabled explicitly. - - The `pylint.extensions.emptystring`` and ``pylint.extensions.compare-to-zero`` extensions no longer exists and - needs to be removed from the ``load-plugins`` option. +The compare to empty string checker (``pylint.extensions.emptystring``) and the compare to +zero checker (``pylint.extensions.compare-to-zero``) have been removed and their checks are +now part of the implicit booleaness checker: + +``compare-to-zero`` was renamed ``use-implicit-booleaness-not-comparison-to-zero`` and +``compare-to-empty-string`` was renamed ``use-implicit-booleaness-not-comparison-to-string`` +and they now need to be enabled explicitly. + +The `pylint.extensions.emptystring`` and ``pylint.extensions.compare-to-zero`` extensions +no longer exists and needs to be removed from the ``load-plugins`` option. This permits to make their likeness explicit and will provide better performance as they share most of their conditions to be raised. |