django/django

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

Summary

Maintainability
C
1 day
Test Coverage

File creation.py has 292 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import os
import sys
from io import StringIO

from django.apps import apps
Severity: Minor
Found in django/db/backends/base/creation.py - About 3 hrs to fix

    Function serialize_db_to_string has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def serialize_db_to_string(self):
            """
            Serialize all data in the database into a JSON string.
            Designed only for test runner usage; will not handle large
            amounts of data.
    Severity: Minor
    Found in django/db/backends/base/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 _create_test_db has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def _create_test_db(self, verbosity, autoclobber, keepdb=False):
            """
            Internal implementation - create the test db tables.
            """
            test_database_name = self._get_test_db_name()
    Severity: Minor
    Found in django/db/backends/base/creation.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 mark_expected_failures_and_skips has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def mark_expected_failures_and_skips(self):
            """
            Mark tests in Django's test suite which are expected failures on this
            database and test which should be skipped on this database.
            """
    Severity: Minor
    Found in django/db/backends/base/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 create_test_db has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_test_db(
            self, verbosity=1, autoclobber=False, serialize=True, keepdb=False
        ):
            """
            Create a test database, prompting the user for confirmation if the
    Severity: Minor
    Found in django/db/backends/base/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 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def destroy_test_db(
            self, old_database_name=None, verbosity=1, keepdb=False, suffix=None
        ):
            """
            Destroy a test database, prompting the user for confirmation if the
    Severity: Minor
    Found in django/db/backends/base/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

    There are no issues that match your filters.

    Category
    Status