From 4c465e8e889c20ac0e6542fa7734a56d4c9ebb70 Mon Sep 17 00:00:00 2001 From: Carey Metcalfe Date: Thu, 12 May 2022 22:59:10 -0400 Subject: [PATCH 1/2] Update references to `loop-invariant-global-usage` Looks like these were missed as part of #27 --- perflint/for_loop_checker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/perflint/for_loop_checker.py b/perflint/for_loop_checker.py index 88ac894..c17d4a8 100644 --- a/perflint/for_loop_checker.py +++ b/perflint/for_loop_checker.py @@ -303,7 +303,7 @@ def visit_augassign(self, node: nodes.AugAssign) -> None: if isinstance(node.target, nodes.AssignName): self._loop_assignments[-1].add(node.target.name) - @checker_utils.check_messages("loop-invariant-global-usage") + @checker_utils.check_messages("loop-global-usage") def visit_name(self, node: nodes.Name) -> None: """Look for global names""" if self._loop_names: @@ -321,7 +321,7 @@ def visit_name(self, node: nodes.Name) -> None: and isinstance(scope.globals[node.name][0], nodes.AssignName) ): if self._loop_level > 0: - self.add_message("loop-invariant-global-usage", node=node) + self.add_message("loop-global-usage", node=node) def visit_const(self, node: nodes.Const) -> None: if self._loop_level == 0: From f34391d62535bee2e0de4235d85b2a966083cb92 Mon Sep 17 00:00:00 2001 From: Anthony Shaw Date: Mon, 16 May 2022 08:13:13 +1000 Subject: [PATCH 2/2] Update test case --- tests/test_loop_invariant.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_loop_invariant.py b/tests/test_loop_invariant.py index a184fb7..ec640fb 100644 --- a/tests/test_loop_invariant.py +++ b/tests/test_loop_invariant.py @@ -95,7 +95,7 @@ def test(): #@ """ ) - with self.assertAddedMessage("loop-invariant-global-usage"): + with self.assertAddedMessage("loop-global-usage"): self.walk(test_func) def test_assigned_global_in_for_loop(self):