django/django

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

Summary

Maintainability
B
5 hrs
Test Coverage

Function _alter_field_type_workaround has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def _alter_field_type_workaround(self, model, old_field, new_field):
        """
        Oracle refuses to change from some type to other type.
        What we need to do instead is:
        - Add a nullable version of the desired field with a temporary name. If
Severity: Minor
Found in django/db/backends/oracle/schema.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 alter_field has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def alter_field(self, model, old_field, new_field, strict=False):
        try:
            super().alter_field(model, old_field, new_field, strict)
        except DatabaseError as e:
            description = str(e)
Severity: Minor
Found in django/db/backends/oracle/schema.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 quote_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def quote_value(self, value):
        if isinstance(value, (datetime.date, datetime.time, datetime.datetime)):
            return "'%s'" % value
        elif isinstance(value, datetime.timedelta):
            return "'%s'" % duration_iso_string(value)
Severity: Minor
Found in django/db/backends/oracle/schema.py - About 45 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 _alter_column_type_sql has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _alter_column_type_sql(
Severity: Minor
Found in django/db/backends/oracle/schema.py - About 45 mins to fix

    Avoid too many return statements within this function.
    Open

                return "1" if value else "0"
    Severity: Major
    Found in django/db/backends/oracle/schema.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return str(value)
      Severity: Major
      Found in django/db/backends/oracle/schema.py - About 30 mins to fix

        There are no issues that match your filters.

        Category
        Status