django/django

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

Summary

Maintainability
C
1 day
Test Coverage

File introspection.py has 390 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from collections import namedtuple

from django.db import models
from django.db.backends.base.introspection import BaseDatabaseIntrospection
from django.db.backends.base.introspection import FieldInfo as BaseFieldInfo
Severity: Minor
Found in django/db/backends/oracle/introspection.py - About 5 hrs to fix

    Function get_field_type has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_field_type(self, data_type, description):
            if data_type == oracledb.NUMBER:
                precision, scale = description[4:6]
                if scale == 0:
                    if precision > 11:
    Severity: Minor
    Found in django/db/backends/oracle/introspection.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

    Avoid too many return statements within this function.
    Open

            return super().get_field_type(data_type, description)
    Severity: Major
    Found in django/db/backends/oracle/introspection.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return "FloatField"
      Severity: Major
      Found in django/db/backends/oracle/introspection.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                            return "IntegerField"
        Severity: Major
        Found in django/db/backends/oracle/introspection.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return "JSONField"
          Severity: Major
          Found in django/db/backends/oracle/introspection.py - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status