diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py index 691d83ff9f8..e6af22689bf 100644 --- a/pylint/checkers/variables.py +++ b/pylint/checkers/variables.py @@ -2242,7 +2242,9 @@ def _loopvar_name(self, node: astroid.Name) -> None: self.add_message("undefined-loop-variable", args=node.name, node=node) return if any( - isinstance(else_stmt, (nodes.Return, nodes.Raise, nodes.Break, nodes.Continue)) + isinstance( + else_stmt, (nodes.Return, nodes.Raise, nodes.Break, nodes.Continue) + ) for else_stmt in assign.orelse ): return