pylint/checkers/base.py
def _check_else_on_loop(self, node):
        """Check that any loop with an else clause has a break statement."""
        if node.orelse and not _loop_exits_early(node):
            self.add_message(
                "useless-else-on-loop",
                node=node,
                # This is not optimal, but the line previous
                # to the first statement in the else clause
                # will usually be the one that contains the else:.
                line=node.orelse[0].lineno - 1,
            )
def _check_else_on_loop(self, node):
        if node.orelse and not _loop_exits_early(node):
            self.add_message(
                "useless-else-on-loop",
                node=node,
                # This is not optimal, but the line previous
                # to the first statement in the else clause
                # will usually be the one that contains the else:.
                line=node.orelse[0].lineno - 1,
            )
def _check_else_on_loop ( self , node ) : if node . orelse and not _loop_exits_early ( node ) : self . add_message ( "useless-else-on-loop" , node = node , # This is not optimal, but the line previous # to the first statement in the else clause # will usually be the one that contains the else:. line = node . orelse [ 0 ] . lineno - 1 , )
Check that any loop with an else clause has a break statement.
Check that any loop with an else clause has a break statement .