django/django

View on GitHub
django/core/management/__init__.py

Summary

Maintainability
D
2 days
Test Coverage

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

def call_command(command_name, *args, **options):
    """
    Call the given command, with the given options and args/kwargs.

    This is the primary API you should use for calling specific commands.
Severity: Minor
Found in django/core/management/__init__.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

File __init__.py has 343 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import functools
import os
import pkgutil
import sys
from argparse import (
Severity: Minor
Found in django/core/management/__init__.py - About 4 hrs to fix

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

        def execute(self):
            """
            Given the command-line arguments, figure out which subcommand is being
            run, create a parser appropriate to that command, and run it.
            """
    Severity: Minor
    Found in django/core/management/__init__.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 main_help_text has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def main_help_text(self, commands_only=False):
            """Return the script's main help text, as a string."""
            if commands_only:
                usage = sorted(get_commands())
            else:
    Severity: Minor
    Found in django/core/management/__init__.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 autocomplete has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def autocomplete(self):
            """
            Output completion suggestions for BASH.
    
            The output of this function is passed to BASH's `COMPREPLY` variable
    Severity: Minor
    Found in django/core/management/__init__.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 fetch_command has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def fetch_command(self, subcommand):
            """
            Try to fetch the given subcommand, printing a message with the
            appropriate command called from the command line (usually
            "django-admin" or "manage.py") if it can't be found.
    Severity: Minor
    Found in django/core/management/__init__.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

    There are no issues that match your filters.

    Category
    Status