django/django

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

Summary

Maintainability
D
2 days
Test Coverage

File constraints.py has 612 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import warnings
from enum import Enum
from types import NoneType

from django.core import checks
Severity: Major
Found in django/db/models/constraints.py - About 1 day to fix

    Consider simplifying this complex logical expression.
    Open

            if isinstance(other, UniqueConstraint):
                return (
                    self.name == other.name
                    and self.fields == other.fields
                    and self.condition == other.condition
    Severity: Critical
    Found in django/db/models/constraints.py - About 2 hrs to fix

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

          def __init__(
      Severity: Major
      Found in django/db/models/constraints.py - About 1 hr to fix

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

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

          Avoid deeply nested control flow statements.
          Open

                                  if constraint is self:
                                      raise ValidationError(
                                          instance.unique_error_message(model, self.fields),
                                      )
                  else:
          Severity: Major
          Found in django/db/models/constraints.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    for expr in expression.flatten():
                                        if isinstance(expr, F) and expr.name in exclude:
                                            return
                                elif isinstance(expression, F) and expression.name in exclude:
            Severity: Major
            Found in django/db/models/constraints.py - About 45 mins to fix

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

                  def validate(self, model, instance, exclude=None, using=DEFAULT_DB_ALIAS):
              Severity: Minor
              Found in django/db/models/constraints.py - About 35 mins to fix

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

                    def validate(self, model, instance, exclude=None, using=DEFAULT_DB_ALIAS):
                Severity: Minor
                Found in django/db/models/constraints.py - About 35 mins to fix

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

                      def validate(self, model, instance, exclude=None, using=DEFAULT_DB_ALIAS):
                  Severity: Minor
                  Found in django/db/models/constraints.py - About 35 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status