Showing 8 of 11 total issues
Function prefetch
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def prefetch(self, *names):
obj = self._clone()
for opt in names:
if isinstance(opt, PrefetchOption):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function fetch
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def fetch(self, dataset, name, model, forwarders, db):
collect = self.collect or forwarders
try:
data_mapping = collections.defaultdict(list)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function exec_in_env
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def exec_in_env():
env_path = join(base_path, ".tox", "bootstrap")
if sys.platform == "win32":
bin_path = join(env_path, "Scripts")
else:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, filter=None, reverse_mapper=None, decorator=None, mapper=None, collect=None):
if filter:
self.filter = filter
elif not hasattr(self, 'filter'):
raise RuntimeError("You must define a filter function")
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if not isinstance(manager, PrefetchManagerMixin):
raise InvalidPrefetch('Manager for %s is not a PrefetchManagerMixin instance.' % model)
prefetch_definitions = manager.prefetch_definitions
Function fetch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def fetch(self, dataset, name, model, forwarders, db):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, model=None, query=None, using=None,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, filter=None, reverse_mapper=None, decorator=None, mapper=None, collect=None):