diff options
author | hippo91 <guillaume.peillex@gmail.com> | 2018-01-23 20:52:15 +0100 |
---|---|---|
committer | hippo91 <guillaume.peillex@gmail.com> | 2018-01-23 20:52:15 +0100 |
commit | 992a5f18dbe1f723811b1aa2ee84c78ead753d61 (patch) | |
tree | 26fdb6a80576cb973173b9b74ad9a69b2dc8e236 /pylint/checkers/refactoring.py | |
parent | 0d5faa90ac33adda76a373057e6aeb4b8e110afe (diff) | |
download | pylint-git-992a5f18dbe1f723811b1aa2ee84c78ead753d61.tar.gz |
Add of four test dealing with if statements and function definition under them
Diffstat (limited to 'pylint/checkers/refactoring.py')
-rw-r--r-- | pylint/checkers/refactoring.py | 4 |
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 |