django/django

View on GitHub
django/core/management/commands/loaddata.py

Summary

Maintainability
D
2 days
Test Coverage

Function load_label has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    def load_label(self, fixture_label):
        """Load fixtures files for a given label."""
        show_progress = self.verbosity >= 3
        for fixture_file, fixture_dir, fixture_name in self.find_fixtures(fixture_label):
            _, ser_fmt, cmp_fmt = self.parse_name(os.path.basename(fixture_file))
Severity: Minor
Found in django/core/management/commands/loaddata.py - About 4 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 loaddata has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def loaddata(self, fixture_labels):
        connection = connections[self.using]

        # Keep a count of the installed objects and fixtures
        self.fixture_count = 0
Severity: Minor
Found in django/core/management/commands/loaddata.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

File loaddata.py has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import functools
import glob
import gzip
import os
import sys
Severity: Minor
Found in django/core/management/commands/loaddata.py - About 3 hrs to fix

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

        def find_fixtures(self, fixture_label):
            """Find fixture files for a given label."""
            if fixture_label == READ_STDIN:
                return [(READ_STDIN, None, READ_STDIN)]
    
    
    Severity: Minor
    Found in django/core/management/commands/loaddata.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 fixture_dirs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def fixture_dirs(self):
            """
            Return a list of fixture directories.
    
            The list contains the 'fixtures' subdirectory of each installed
    Severity: Minor
    Found in django/core/management/commands/loaddata.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 parse_name has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_name(self, fixture_name):
            """
            Split fixture name in name, serialization format, compression format.
            """
            if fixture_name == READ_STDIN:
    Severity: Minor
    Found in django/core/management/commands/loaddata.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

    There are no issues that match your filters.

    Category
    Status