Path 1: 3467 calls (1.0)

FunctionDef (3467)

1@utils.only_required_for_messages(
2        "too-many-nested-blocks",
3        "inconsistent-return-statements",
4        "useless-return",
5        "consider-using-with",
6    )
7    def leave_functiondef(self, node: nodes.FunctionDef) -> None:
8        # check left-over nested blocks stack
9        self._emit_nested_blocks_message_if_needed(self._nested_blocks)
10        # new scope = reinitialize the stack of nested blocks
11        self._nested_blocks = []
12        # check consistent return statements
13        self._check_consistent_returns(node)
14        # check for single return or return None at the end
15        self._check_return_at_the_end(node)
16        self._return_nodes[node.name] = []
17        # check for context managers that have been created but not used
18        self._emit_consider_using_with_if_needed(
19            self._consider_using_with_stack.function_scope
20        )
21        self._consider_using_with_stack.function_scope.clear()