helium/resource.py
File resource.py
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"""Base Resource behavior."""
from __future__ import unicode_literals
from future.utils import iteritems
from builtins import filter as _filter
Function _mk_one
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def _mk_one(cls, session,
singleton=False, include=None, resource_classes=None):
classes = resource_classes or [cls]
registry = {clazz._resource_type(): clazz for clazz in classes}
- 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 _update_attributes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def _update_attributes(self, json):
super(Resource, self)._update_attributes(json)
# promote id
self.id = json.get('id', None)
# promote all top level attributes
- 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"