django/django

View on GitHub
django/contrib/gis/geos/mutable_list.py

Summary

Maintainability
B
6 hrs
Test Coverage

ListMixin has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

class ListMixin:
    """
    A base class which provides complete list interface.
    Derived classes must call ListMixin's __init__() function
    and implement the following:
Severity: Minor
Found in django/contrib/gis/geos/mutable_list.py - About 3 hrs to fix

    Function _assign_simple_slice has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def _assign_simple_slice(self, start, stop, valueList):
            "Assign a simple slice; Can assign slice of any length"
            origLen = len(self)
            stop = max(start, stop)
            newLen = origLen - stop + start + len(valueList)
    Severity: Minor
    Found in django/contrib/gis/geos/mutable_list.py - About 1 hr 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 _assign_extended_slice_rebuild has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _assign_extended_slice_rebuild(self, start, stop, step, valueList):
            "Assign an extended slice by rebuilding entire list"
            indexList = range(start, stop, step)
            # extended slice, only allow assigning slice of same size
            if len(valueList) != len(indexList):
    Severity: Minor
    Found in django/contrib/gis/geos/mutable_list.py - About 35 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 __lt__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def __lt__(self, other):
            olen = len(other)
            for i in range(olen):
                try:
                    c = self[i] < other[i]
    Severity: Minor
    Found in django/contrib/gis/geos/mutable_list.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