summaryrefslogtreecommitdiff
path: root/pylint/checkers/classes.py
diff options
context:
space:
mode:
authorNick Drozd <nicholasdrozd@gmail.com>2018-01-02 18:50:41 -0600
committerClaudiu Popa <pcmanticore@gmail.com>2018-01-04 08:11:09 +0100
commite45dcf33bfe0445e0fb7dd80539d52f4aa7c3f62 (patch)
tree9ab297ba056ca2016c9214525bc794056609f617 /pylint/checkers/classes.py
parent170fa13e22039797faf51957d3e2c5d07a3ed0aa (diff)
downloadpylint-git-e45dcf33bfe0445e0fb7dd80539d52f4aa7c3f62.tar.gz
Set max-returns to 11
Previously, the greatest number of return statements in a function was 15 (checkers.typecheck). 11 is the lowest I could get it without aggressive rewriting.
Diffstat (limited to 'pylint/checkers/classes.py')
-rw-r--r--pylint/checkers/classes.py37
1 files changed, 16 insertions, 21 deletions
diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py
index 83e33046c..2216d703b 100644
--- a/pylint/checkers/classes.py
+++ b/pylint/checkers/classes.py
@@ -798,11 +798,9 @@ a metaclass class method.'}
other implementation to take precedence.
'''
- if not function.is_method():
- return
-
- if function.decorators:
- # With decorators is a change of use
+ if (not function.is_method()
+ # With decorators is a change of use
+ or function.decorators):
return
body = function.body
@@ -817,10 +815,9 @@ a metaclass class method.'}
return
call = statement.value
- if not isinstance(call, astroid.Call):
- return
- if not isinstance(call.func, astroid.Attribute):
- # Not a super() attribute access.
+ if (not isinstance(call, astroid.Call)
+ # Not a super() attribute access.
+ or not isinstance(call.func, astroid.Attribute)):
return
# Should be a super call.
@@ -836,14 +833,12 @@ a metaclass class method.'}
if call.func.attrname != function.name:
return
- # Should be a super call with the MRO pointer being the current class
- # and the type being the current instance.
+ # Should be a super call with the MRO pointer being the
+ # current class and the type being the current instance.
current_scope = function.parent.scope()
- if super_call.mro_pointer != current_scope:
- return
- if not isinstance(super_call.type, astroid.Instance):
- return
- if super_call.type.name != current_scope.name:
+ if (super_call.mro_pointer != current_scope
+ or not isinstance(super_call.type, astroid.Instance)
+ or super_call.type.name != current_scope.name):
return
# Check values of default args
@@ -857,11 +852,11 @@ a metaclass class method.'}
# dictionary.
# This may happen with astroid build from living objects
continue
- if not isinstance(meth_node, astroid.FunctionDef):
- # If the method have an ancestor which is not a function
- # then it is legitimate to redefine it
- return
- if _has_different_parameters_default_value(meth_node.args, function.args):
+ if (not isinstance(meth_node, astroid.FunctionDef)
+ # If the method have an ancestor which is not a
+ # function then it is legitimate to redefine it
+ or _has_different_parameters_default_value(
+ meth_node.args, function.args)):
return
else:
break