From 7ae0fe58233332bab4a5a429d53fe2eab3735194 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Sun, 6 Nov 2022 08:24:07 +0100 Subject: [PATCH] [implicit_booleaness_checker] Add the confidence to related messages First step prior doing #6870 in order to make it more reviewable. --- .pyenchant_pylint_custom_dict.txt | 3 + .../implicit_booleaness_checker.py | 61 ++++++++++-------- pylint/extensions/comparetozero.py | 3 +- pylint/extensions/emptystring.py | 3 +- .../ext/comparetozero/comparetozero.txt | 8 +-- .../emptystring/empty_string_comparison.txt | 8 +-- ...use_implicit_booleaness_not_comparison.txt | 64 +++++++++---------- .../u/use/use_implicit_booleaness_not_len.txt | 46 ++++++------- 8 files changed, 105 insertions(+), 91 deletions(-) diff --git a/.pyenchant_pylint_custom_dict.txt b/.pyenchant_pylint_custom_dict.txt index ff95b085c2..2b8e846a5b 100644 --- a/.pyenchant_pylint_custom_dict.txt +++ b/.pyenchant_pylint_custom_dict.txt @@ -31,6 +31,7 @@ bla bom bool boolean +booleaness boolop boundmethod builtins @@ -106,6 +107,7 @@ epytext erroring etree expr +falsey favour filepath filestream @@ -326,6 +328,7 @@ toplevel towncrier tp truthness +truthey tryexcept txt typecheck diff --git a/pylint/checkers/refactoring/implicit_booleaness_checker.py b/pylint/checkers/refactoring/implicit_booleaness_checker.py index 13172a97eb..20d8e0c306 100644 --- a/pylint/checkers/refactoring/implicit_booleaness_checker.py +++ b/pylint/checkers/refactoring/implicit_booleaness_checker.py @@ -9,6 +9,7 @@ from pylint import checkers from pylint.checkers import utils +from pylint.interfaces import HIGH, INFERENCE class ImplicitBooleanessChecker(checkers.BaseChecker): @@ -99,7 +100,11 @@ def visit_call(self, node: nodes.Call) -> None: ) if isinstance(len_arg, generator_or_comprehension): # The node is a generator or comprehension as in len([x for x in ...]) - self.add_message("use-implicit-booleaness-not-len", node=node) + self.add_message( + "use-implicit-booleaness-not-len", + node=node, + confidence=HIGH, + ) return try: instance = next(len_arg.infer()) @@ -113,7 +118,11 @@ def visit_call(self, node: nodes.Call) -> None: if "range" in mother_classes or ( affected_by_pep8 and not self.instance_has_bool(instance) ): - self.add_message("use-implicit-booleaness-not-len", node=node) + self.add_message( + "use-implicit-booleaness-not-len", + node=node, + confidence=INFERENCE, + ) @staticmethod def instance_has_bool(class_def: nodes.ClassDef) -> bool: @@ -134,7 +143,9 @@ def visit_unaryop(self, node: nodes.UnaryOp) -> None: and node.op == "not" and utils.is_call_of_name(node.operand, "len") ): - self.add_message("use-implicit-booleaness-not-len", node=node) + self.add_message( + "use-implicit-booleaness-not-len", node=node, confidence=HIGH + ) @utils.only_required_for_messages("use-implicit-booleaness-not-comparison") def visit_compare(self, node: nodes.Compare) -> None: @@ -177,35 +188,33 @@ def _check_use_implicit_booleaness_not_comparison( # No need to check for operator when visiting compare node if operator in {"==", "!=", ">=", ">", "<=", "<"}: - collection_literal = "{}" - if isinstance(literal_node, nodes.List): - collection_literal = "[]" - if isinstance(literal_node, nodes.Tuple): - collection_literal = "()" - - instance_name = "x" - if isinstance(target_node, nodes.Call) and target_node.func: - instance_name = f"{target_node.func.as_string()}(...)" - elif isinstance(target_node, (nodes.Attribute, nodes.Name)): - instance_name = target_node.as_string() - - original_comparison = ( - f"{instance_name} {operator} {collection_literal}" - ) - suggestion = ( - f"{instance_name}" - if operator == "!=" - else f"not {instance_name}" - ) self.add_message( "use-implicit-booleaness-not-comparison", - args=( - original_comparison, - suggestion, + args=self._implicit_booleaness_message_args( + literal_node, operator, target_node ), node=node, + confidence=HIGH, ) + def _implicit_booleaness_message_args( + self, literal_node: nodes.NodeNG, operator: str, target_node: nodes.NodeNG + ) -> tuple[str, str]: + """Helper to get the right message for "use-implicit-booleaness-not-comparison".""" + collection_literal = "{}" + if isinstance(literal_node, nodes.List): + collection_literal = "[]" + if isinstance(literal_node, nodes.Tuple): + collection_literal = "()" + instance_name = "x" + if isinstance(target_node, nodes.Call) and target_node.func: + instance_name = f"{target_node.func.as_string()}(...)" + elif isinstance(target_node, (nodes.Attribute, nodes.Name)): + instance_name = target_node.as_string() + original_comparison = f"{instance_name} {operator} {collection_literal}" + suggestion = f"{instance_name}" if operator == "!=" else f"not {instance_name}" + return original_comparison, suggestion + @staticmethod def base_names_of_instance(node: bases.Uninferable | bases.Instance) -> list[str]: """Return all names inherited by a class instance or those returned by a diff --git a/pylint/extensions/comparetozero.py b/pylint/extensions/comparetozero.py index 8aca300d2d..f418c1833b 100644 --- a/pylint/extensions/comparetozero.py +++ b/pylint/extensions/comparetozero.py @@ -14,6 +14,7 @@ from pylint import checkers from pylint.checkers import utils +from pylint.interfaces import HIGH if TYPE_CHECKING: from pylint.lint import PyLinter @@ -70,7 +71,7 @@ def visit_compare(self, node: nodes.Compare) -> None: error_detected = True if error_detected: - self.add_message("compare-to-zero", node=node) + self.add_message("compare-to-zero", node=node, confidence=HIGH) def register(linter: PyLinter) -> None: diff --git a/pylint/extensions/emptystring.py b/pylint/extensions/emptystring.py index fcae077a29..5ff4ccb6d7 100644 --- a/pylint/extensions/emptystring.py +++ b/pylint/extensions/emptystring.py @@ -13,6 +13,7 @@ from pylint import checkers from pylint.checkers import utils +from pylint.interfaces import HIGH if TYPE_CHECKING: from pylint.lint import PyLinter @@ -64,7 +65,7 @@ def visit_compare(self, node: nodes.Compare) -> None: error_detected = True if error_detected: - self.add_message("compare-to-empty-string", node=node) + self.add_message("compare-to-empty-string", node=node, confidence=HIGH) def register(linter: PyLinter) -> None: diff --git a/tests/functional/ext/comparetozero/comparetozero.txt b/tests/functional/ext/comparetozero/comparetozero.txt index 34f76c94e2..f29aabae50 100644 --- a/tests/functional/ext/comparetozero/comparetozero.txt +++ b/tests/functional/ext/comparetozero/comparetozero.txt @@ -1,4 +1,4 @@ -compare-to-zero:6:3:6:9::Avoid comparisons to zero:UNDEFINED -compare-to-zero:9:3:9:13::Avoid comparisons to zero:UNDEFINED -compare-to-zero:12:3:12:9::Avoid comparisons to zero:UNDEFINED -compare-to-zero:15:3:15:9::Avoid comparisons to zero:UNDEFINED +compare-to-zero:6:3:6:9::Avoid comparisons to zero:HIGH +compare-to-zero:9:3:9:13::Avoid comparisons to zero:HIGH +compare-to-zero:12:3:12:9::Avoid comparisons to zero:HIGH +compare-to-zero:15:3:15:9::Avoid comparisons to zero:HIGH diff --git a/tests/functional/ext/emptystring/empty_string_comparison.txt b/tests/functional/ext/emptystring/empty_string_comparison.txt index 5b259bc464..7d4ddedfbb 100644 --- a/tests/functional/ext/emptystring/empty_string_comparison.txt +++ b/tests/functional/ext/emptystring/empty_string_comparison.txt @@ -1,4 +1,4 @@ -compare-to-empty-string:6:3:6:10::Avoid comparisons to empty string:UNDEFINED -compare-to-empty-string:9:3:9:14::Avoid comparisons to empty string:UNDEFINED -compare-to-empty-string:12:3:12:10::Avoid comparisons to empty string:UNDEFINED -compare-to-empty-string:15:3:15:10::Avoid comparisons to empty string:UNDEFINED +compare-to-empty-string:6:3:6:10::Avoid comparisons to empty string:HIGH +compare-to-empty-string:9:3:9:14::Avoid comparisons to empty string:HIGH +compare-to-empty-string:12:3:12:10::Avoid comparisons to empty string:HIGH +compare-to-empty-string:15:3:15:10::Avoid comparisons to empty string:HIGH diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison.txt b/tests/functional/u/use/use_implicit_booleaness_not_comparison.txt index d316d5acd3..bcf4e0aa85 100644 --- a/tests/functional/u/use/use_implicit_booleaness_not_comparison.txt +++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison.txt @@ -1,32 +1,32 @@ -use-implicit-booleaness-not-comparison:14:7:14:21:github_issue_4774:'bad_list == []' can be simplified to 'not bad_list' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:22:3:22:20::'empty_tuple == ()' can be simplified to 'not empty_tuple' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:25:3:25:19::'empty_list == []' can be simplified to 'not empty_list' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:28:3:28:19::'empty_dict == {}' can be simplified to 'not empty_dict' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:31:3:31:20::'empty_tuple == ()' can be simplified to 'not empty_tuple' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:34:3:34:19::'empty_list == []' can be simplified to 'not empty_list' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:37:3:37:19::'empty_dict == {}' can be simplified to 'not empty_dict' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:42:11:42:18:bad_tuple_return:'t == ()' can be simplified to 'not t' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:46:11:46:18:bad_list_return:'b == []' can be simplified to 'not b' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:50:11:50:18:bad_dict_return:'c == {}' can be simplified to 'not c' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:52:7:52:24::'empty_tuple == ()' can be simplified to 'not empty_tuple' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:53:7:53:23::'empty_list == []' can be simplified to 'not empty_list' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:54:7:54:23::'empty_dict != {}' can be simplified to 'empty_dict' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:55:7:55:23::'empty_tuple < ()' can be simplified to 'not empty_tuple' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:56:7:56:23::'empty_list <= []' can be simplified to 'not empty_list' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:57:7:57:23::'empty_tuple > ()' can be simplified to 'not empty_tuple' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:58:7:58:23::'empty_list >= []' can be simplified to 'not empty_list' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:83:3:83:10::'a == []' can be simplified to 'not a' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:95:3:95:10::'e == []' can be simplified to 'not e' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:95:15:95:22::'f == {}' can be simplified to 'not f' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:133:3:133:14::'A.lst == []' can be simplified to 'not A.lst' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:137:3:137:14::'A.lst == []' can be simplified to 'not A.lst' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:141:3:141:20::'A.test(...) == []' can be simplified to 'not A.test(...)' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:149:3:149:24::'test_function(...) == []' can be simplified to 'not test_function(...)' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:156:3:156:20::'numpy_array == []' can be simplified to 'not numpy_array' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:158:3:158:20::'numpy_array != []' can be simplified to 'numpy_array' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:160:3:160:20::'numpy_array >= ()' can be simplified to 'not numpy_array' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:185:3:185:13::'data == {}' can be simplified to 'not data' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:187:3:187:13::'data != {}' can be simplified to 'data' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:195:3:195:26::'long_test == {}' can be simplified to 'not long_test' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:233:11:233:41:test_func:'my_class.parent_function == {}' can be simplified to 'not my_class.parent_function' as an empty sequence is falsey:UNDEFINED -use-implicit-booleaness-not-comparison:234:11:234:37:test_func:'my_class.my_property == {}' can be simplified to 'not my_class.my_property' as an empty sequence is falsey:UNDEFINED +use-implicit-booleaness-not-comparison:14:7:14:21:github_issue_4774:'bad_list == []' can be simplified to 'not bad_list' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:22:3:22:20::'empty_tuple == ()' can be simplified to 'not empty_tuple' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:25:3:25:19::'empty_list == []' can be simplified to 'not empty_list' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:28:3:28:19::'empty_dict == {}' can be simplified to 'not empty_dict' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:31:3:31:20::'empty_tuple == ()' can be simplified to 'not empty_tuple' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:34:3:34:19::'empty_list == []' can be simplified to 'not empty_list' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:37:3:37:19::'empty_dict == {}' can be simplified to 'not empty_dict' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:42:11:42:18:bad_tuple_return:'t == ()' can be simplified to 'not t' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:46:11:46:18:bad_list_return:'b == []' can be simplified to 'not b' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:50:11:50:18:bad_dict_return:'c == {}' can be simplified to 'not c' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:52:7:52:24::'empty_tuple == ()' can be simplified to 'not empty_tuple' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:53:7:53:23::'empty_list == []' can be simplified to 'not empty_list' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:54:7:54:23::'empty_dict != {}' can be simplified to 'empty_dict' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:55:7:55:23::'empty_tuple < ()' can be simplified to 'not empty_tuple' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:56:7:56:23::'empty_list <= []' can be simplified to 'not empty_list' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:57:7:57:23::'empty_tuple > ()' can be simplified to 'not empty_tuple' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:58:7:58:23::'empty_list >= []' can be simplified to 'not empty_list' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:83:3:83:10::'a == []' can be simplified to 'not a' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:95:3:95:10::'e == []' can be simplified to 'not e' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:95:15:95:22::'f == {}' can be simplified to 'not f' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:133:3:133:14::'A.lst == []' can be simplified to 'not A.lst' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:137:3:137:14::'A.lst == []' can be simplified to 'not A.lst' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:141:3:141:20::'A.test(...) == []' can be simplified to 'not A.test(...)' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:149:3:149:24::'test_function(...) == []' can be simplified to 'not test_function(...)' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:156:3:156:20::'numpy_array == []' can be simplified to 'not numpy_array' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:158:3:158:20::'numpy_array != []' can be simplified to 'numpy_array' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:160:3:160:20::'numpy_array >= ()' can be simplified to 'not numpy_array' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:185:3:185:13::'data == {}' can be simplified to 'not data' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:187:3:187:13::'data != {}' can be simplified to 'data' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:195:3:195:26::'long_test == {}' can be simplified to 'not long_test' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:233:11:233:41:test_func:'my_class.parent_function == {}' can be simplified to 'not my_class.parent_function' as an empty sequence is falsey:HIGH +use-implicit-booleaness-not-comparison:234:11:234:37:test_func:'my_class.my_property == {}' can be simplified to 'not my_class.my_property' as an empty sequence is falsey:HIGH diff --git a/tests/functional/u/use/use_implicit_booleaness_not_len.txt b/tests/functional/u/use/use_implicit_booleaness_not_len.txt index 11412f5b28..85917de828 100644 --- a/tests/functional/u/use/use_implicit_booleaness_not_len.txt +++ b/tests/functional/u/use/use_implicit_booleaness_not_len.txt @@ -1,26 +1,26 @@ -use-implicit-booleaness-not-len:4:3:4:14::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:7:3:7:18::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:11:9:11:34::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:14:11:14:22::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED +use-implicit-booleaness-not-len:4:3:4:14::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:INFERENCE +use-implicit-booleaness-not-len:7:3:7:18::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:HIGH +use-implicit-booleaness-not-len:11:9:11:34::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:INFERENCE +use-implicit-booleaness-not-len:14:11:14:22::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:INFERENCE comparison-of-constants:39:3:39:28::"Comparison between constants: '0 < 1' has a constant value":HIGH -use-implicit-booleaness-not-len:56:5:56:16::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:61:5:61:20::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:64:6:64:17::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:67:6:67:21::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:70:12:70:23::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:73:6:73:21::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:96:11:96:20:github_issue_1331_v2:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:99:11:99:20:github_issue_1331_v3:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:102:17:102:26:github_issue_1331_v4:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:104:9:104:15::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:105:9:105:20::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:124:11:124:34:github_issue_1879:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:125:11:125:39:github_issue_1879:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:126:11:126:24:github_issue_1879:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:127:11:127:35:github_issue_1879:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:128:11:128:33:github_issue_1879:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:129:11:129:41:github_issue_1879:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:130:11:130:43:github_issue_1879:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED -use-implicit-booleaness-not-len:171:11:171:42:github_issue_1879:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:UNDEFINED +use-implicit-booleaness-not-len:56:5:56:16::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:INFERENCE +use-implicit-booleaness-not-len:61:5:61:20::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:HIGH +use-implicit-booleaness-not-len:64:6:64:17::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:INFERENCE +use-implicit-booleaness-not-len:67:6:67:21::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:HIGH +use-implicit-booleaness-not-len:70:12:70:23::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:INFERENCE +use-implicit-booleaness-not-len:73:6:73:21::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:HIGH +use-implicit-booleaness-not-len:96:11:96:20:github_issue_1331_v2:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:INFERENCE +use-implicit-booleaness-not-len:99:11:99:20:github_issue_1331_v3:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:INFERENCE +use-implicit-booleaness-not-len:102:17:102:26:github_issue_1331_v4:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:INFERENCE +use-implicit-booleaness-not-len:104:9:104:15::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:INFERENCE +use-implicit-booleaness-not-len:105:9:105:20::Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:INFERENCE +use-implicit-booleaness-not-len:124:11:124:34:github_issue_1879:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:INFERENCE +use-implicit-booleaness-not-len:125:11:125:39:github_issue_1879:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:INFERENCE +use-implicit-booleaness-not-len:126:11:126:24:github_issue_1879:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:INFERENCE +use-implicit-booleaness-not-len:127:11:127:35:github_issue_1879:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:HIGH +use-implicit-booleaness-not-len:128:11:128:33:github_issue_1879:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:HIGH +use-implicit-booleaness-not-len:129:11:129:41:github_issue_1879:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:HIGH +use-implicit-booleaness-not-len:130:11:130:43:github_issue_1879:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:INFERENCE +use-implicit-booleaness-not-len:171:11:171:42:github_issue_1879:Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty:INFERENCE undefined-variable:183:11:183:24:github_issue_4215:Undefined variable 'undefined_var':UNDEFINED undefined-variable:185:11:185:25:github_issue_4215:Undefined variable 'undefined_var2':UNDEFINED