django/django

View on GitHub
django/db/models/indexes.py

Summary

Maintainability
C
1 day
Test Coverage

Function __init__ has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(
        self,
        *expressions,
        fields=(),
        name=None,
Severity: Minor
Found in django/db/models/indexes.py - About 2 hrs 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

File indexes.py has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from types import NoneType

from django.db.backends.utils import names_digest, split_identifier
from django.db.models.expressions import Col, ExpressionList, F, Func, OrderBy
from django.db.models.functions import Collate
Severity: Minor
Found in django/db/models/indexes.py - About 2 hrs to fix

    Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in django/db/models/indexes.py - About 50 mins to fix

      Function resolve_expression has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def resolve_expression(
      Severity: Minor
      Found in django/db/models/indexes.py - About 35 mins to fix

        Function create_sql has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def create_sql(self, model, schema_editor, using="", **kwargs):
                include = [
                    model._meta.get_field(field_name).column for field_name in self.include
                ]
                condition = self._get_condition_sql(model, schema_editor)
        Severity: Minor
        Found in django/db/models/indexes.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 resolve_expression has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def resolve_expression(
                self,
                query=None,
                allow_joins=True,
                reuse=None,
        Severity: Minor
        Found in django/db/models/indexes.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 __repr__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def __repr__(self):
                return "<%s:%s%s%s%s%s%s%s>" % (
                    self.__class__.__qualname__,
                    "" if not self.fields else " fields=%s" % repr(self.fields),
                    "" if not self.expressions else " expressions=%s" % repr(self.expressions),
        Severity: Minor
        Found in django/db/models/indexes.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

        There are no issues that match your filters.

        Category
        Status