fuzeman/byte

View on GitHub
byte/model.py

Summary

Maintainability
B
6 hrs
Test Coverage

File model.py has 332 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-

"""byte - model module."""

from __future__ import absolute_import, division, print_function
Severity: Minor
Found in byte/model.py - About 4 hrs to fix

    Function __create_init has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def __create_init(bases, namespace, properties):
            original = namespace.get('__init__')
    
            def __init__(self, *args, **kwargs):
                self.__collection__ = kwargs.pop('_collection', None)
    Severity: Minor
    Found in byte/model.py - About 55 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 from_plain has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def from_plain(cls, data, strict=True, translate=False):
            """
            Parse model item from plain dictionary.
    
            :param data: Item data
    Severity: Minor
    Found in byte/model.py - About 55 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 __extract_properties has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def __extract_properties(cls, namespace, remove=True):
            if not namespace:
                return
    
            # Iterate over items in `namespace`
    Severity: Minor
    Found in byte/model.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

    Function __decode_property has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def __decode_property(prop, value, strict=True, translate=False):
            # Try decode property value
            try:
                value = prop.decode(
                    value,
    Severity: Minor
    Found in byte/model.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