summaryrefslogtreecommitdiff
path: root/pylint/checkers/refactoring.py
diff options
context:
space:
mode:
Diffstat (limited to 'pylint/checkers/refactoring.py')
-rw-r--r--pylint/checkers/refactoring.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/pylint/checkers/refactoring.py b/pylint/checkers/refactoring.py
index 4032b6230..1f437799d 100644
--- a/pylint/checkers/refactoring.py
+++ b/pylint/checkers/refactoring.py
@@ -583,7 +583,9 @@ class RefactoringChecker(checkers.BaseTokenChecker):
if isinstance(node, astroid.If):
# if statement is returning if there are exactly two return statements in its
# children : one for the body part, the other for the orelse part
- return_stmts = [self._is_node_return_ended(_child) for _child in node.get_children()]
+ # Do not check if inner function definition are return ended.
+ return_stmts = [self._is_node_return_ended(_child) for _child in node.get_children()
+ if not isinstance(_child, astroid.FunctionDef)]
return sum(return_stmts) == 2
# recurses on the children of the node except for those which are except handler
# because one cannot be sure that the handler will really be used