helium/helium-python

View on GitHub
helium/resource.py

Summary

Maintainability
B
4 hrs
Test Coverage

File resource.py has 318 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Base Resource behavior."""

from __future__ import unicode_literals
from future.utils import iteritems
from builtins import filter as _filter
Severity: Minor
Found in helium/resource.py - About 3 hrs to fix

    Function _mk_one has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    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}
    
    
    Severity: Minor
    Found in helium/resource.py - About 45 mins to fix

    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

        def _update_attributes(self, json):
            super(Resource, self)._update_attributes(json)
            # promote id
            self.id = json.get('id', None)
            # promote all top level attributes
    Severity: Minor
    Found in helium/resource.py - About 25 mins to fix

    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

    There are no issues that match your filters.

    Category
    Status