def _check_simplifiable_returning_if(self, node: ast.If) -> None:
        body = node.body
        simple_if_and_root = not (ifs.has_elif(node) or ifs.is_elif(node))
        if keywords.is_simple_return(body) and simple_if_and_root:
            if ifs.has_else(node):
                else_body = node.orelse
                if keywords.is_simple_return(else_body):
                    self.add_violation(SimplifiableReturningIfViolation(node))
                return

            self._check_simplifiable_returning_parent(node)
 def _check_simplifiable_returning_if(self, node: ast.If) -> None:
     body = node.body
     simple_if_and_root = not (ifs.has_elif(node) or ifs.is_elif(node))
     if keywords.is_simple_return(body) and simple_if_and_root:
         if ifs.has_else(node):
             else_body = node.orelse
             if keywords.is_simple_return(else_body):
                 self.add_violation(SimplifiableReturningIfViolation(node))
             return
         body = getattr(node, 'wps_parent').body
         next_index_in_parent = body.index(node) + 1
         if keywords.next_node_returns_bool(body, next_index_in_parent):
             self.add_violation(SimplifiableReturningIfViolation(node))
 def _check_simplifiable_if(self, node: ast.If) -> None:
     if not ifs.has_elif(node) and not ifs.root_if(node):
         body_var = self._is_simplifiable_assign(node.body)
         else_var = self._is_simplifiable_assign(node.orelse)
         if body_var and body_var == else_var:
             self.add_violation(SimplifiableIfViolation(node))