django/django

View on GitHub
django/db/backends/base/base.py

Summary

Maintainability
D
2 days
Test Coverage

BaseDatabaseWrapper has 59 functions (exceeds 20 allowed). Consider refactoring.
Open

class BaseDatabaseWrapper:
    """Represent a database connection."""
    # Mapping of Field objects to their column types.
    data_types = {}
    # Mapping of Field objects to their SQL suffix such as AUTOINCREMENT.
Severity: Major
Found in django/db/backends/base/base.py - About 1 day to fix

    File base.py has 506 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import copy
    import threading
    import time
    import warnings
    from collections import deque
    Severity: Major
    Found in django/db/backends/base/base.py - About 1 day to fix

      Function close_if_unusable_or_obsolete has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def close_if_unusable_or_obsolete(self):
              """
              Close the current connection if unrecoverable errors have occurred
              or if it outlived its maximum age.
              """
      Severity: Minor
      Found in django/db/backends/base/base.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 __init__ has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def __init__(self, settings_dict, alias=DEFAULT_DB_ALIAS):
              # Connection related attributes.
              # The underlying database connection.
              self.connection = None
              # `settings_dict` should be a dictionary containing keys such as
      Severity: Minor
      Found in django/db/backends/base/base.py - About 1 hr to fix

        There are no issues that match your filters.

        Category
        Status