django/django

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

Summary

Maintainability
D
1 day
Test Coverage

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

"""
Oracle database backend for Django.

Requires cx_Oracle: https://oracle.github.io/python-cx_Oracle/
"""
Severity: Minor
Found in django/db/backends/oracle/base.py - About 5 hrs to fix

    Function _guess_input_sizes has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def _guess_input_sizes(self, params_list):
            # Try dict handling; if that fails, treat as sequence
            if hasattr(params_list[0], 'keys'):
                sizes = {}
                for params in params_list:
    Severity: Minor
    Found in django/db/backends/oracle/base.py - About 3 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 __init__ has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, param, cursor, strings_only=False):
            # With raw SQL queries, datetimes can reach this function
            # without being converted by DateTimeField.get_db_prep_value.
            if settings.USE_TZ and (isinstance(param, datetime.datetime) and
                                    not isinstance(param, Oracle_datetime)):
    Severity: Minor
    Found in django/db/backends/oracle/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 _output_type_handler has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def _output_type_handler(cursor, name, defaultType, length, precision, scale):
            """
            Called for each db column fetched from cursors. Return numbers as the
            appropriate Python type.
            """
    Severity: Minor
    Found in django/db/backends/oracle/base.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 _output_type_handler has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def _output_type_handler(cursor, name, defaultType, length, precision, scale):
    Severity: Minor
    Found in django/db/backends/oracle/base.py - About 35 mins to fix

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

          def _fix_for_params(self, query, params, unify_by_values=False):
              # cx_Oracle wants no trailing ';' for SQL statements.  For PL/SQL, it
              # it does want a trailing ';' but not a trailing '/'.  However, these
              # characters must be included in the original query in case the query
              # is being passed to SQL*Plus.
      Severity: Minor
      Found in django/db/backends/oracle/base.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 _setup_environment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def _setup_environment(environ):
          # Cygwin requires some special voodoo to set the environment variables
          # properly so that Oracle will see them.
          if platform.system().upper().startswith('CYGWIN'):
              try:
      Severity: Minor
      Found in django/db/backends/oracle/base.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

      Function init_connection_state has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def init_connection_state(self):
              cursor = self.create_cursor()
              # Set the territory first. The territory overrides NLS_DATE_FORMAT
              # and NLS_TIMESTAMP_FORMAT to the territory default. When all of
              # these are set in single statement it isn't clear what is supposed
      Severity: Minor
      Found in django/db/backends/oracle/base.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