django/django

View on GitHub
django/db/backends/oracle/creation.py

Summary

Maintainability
F
3 days
Test Coverage

Function _create_test_db has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
Open

    def _create_test_db(self, verbosity=1, autoclobber=False, keepdb=False):
        parameters = self._get_test_db_params()
        with self._maindb_connection.cursor() as cursor:
            if self._test_database_create():
                try:
Severity: Minor
Found in django/db/backends/oracle/creation.py - About 1 day 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 creation.py has 413 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import sys

from django.conf import settings
from django.db import DatabaseError
from django.db.backends.base.creation import BaseDatabaseCreation
Severity: Minor
Found in django/db/backends/oracle/creation.py - About 5 hrs to fix

    DatabaseCreation has 32 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class DatabaseCreation(BaseDatabaseCreation):
        @cached_property
        def _maindb_connection(self):
            """
            This is analogous to other backends' `_nodb_connection` property,
    Severity: Minor
    Found in django/db/backends/oracle/creation.py - About 4 hrs to fix

      Function _handle_objects_preventing_db_destruction has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def _handle_objects_preventing_db_destruction(
              self, cursor, parameters, verbosity, autoclobber
          ):
              # There are objects in the test tablespace which prevent dropping it
              # The easy fix is to drop the test user -- but are we allowed to do so?
      Severity: Minor
      Found in django/db/backends/oracle/creation.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

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

          def _execute_statements(
              self, cursor, statements, parameters, verbosity, allow_quiet_fail=False
          ):
              for template in statements:
                  stmt = template % parameters
      Severity: Minor
      Found in django/db/backends/oracle/creation.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 _execute_statements has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _execute_statements(
      Severity: Minor
      Found in django/db/backends/oracle/creation.py - About 35 mins to fix

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

            def _execute_allow_fail_statements(
        Severity: Minor
        Found in django/db/backends/oracle/creation.py - About 35 mins to fix

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

              def _create_test_user(self, cursor, parameters, verbosity, keepdb=False):
                  if verbosity >= 2:
                      self.log("_create_test_user(): username = %s" % parameters["user"])
                  statements = [
                      """CREATE USER %(user)s
          Severity: Minor
          Found in django/db/backends/oracle/creation.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 _destroy_test_db has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def _destroy_test_db(self, test_database_name, verbosity=1):
                  """
                  Destroy a test database, prompting the user for confirmation if the
                  database already exists. Return the name of the test database created.
                  """
          Severity: Minor
          Found in django/db/backends/oracle/creation.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