django/django

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

Summary

Maintainability
D
2 days
Test Coverage

File base.py has 589 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Base classes for writing management commands (named commands which can
be executed through ``django-admin`` or ``manage.py``).
"""

Severity: Major
Found in django/core/management/base.py - About 1 day to fix

    Function check has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        def check(
            self,
            app_configs=None,
            tags=None,
            display_num_errors=False,
    Severity: Minor
    Found in django/core/management/base.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 execute has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def execute(self, *args, **options):
            """
            Try to execute this command, performing system checks if needed (as
            controlled by the ``requires_system_checks`` attribute, except if
            force-skipped).
    Severity: Minor
    Found in django/core/management/base.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 check has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def check(
    Severity: Minor
    Found in django/core/management/base.py - About 45 mins to fix

      Consider simplifying this complex logical expression.
      Open

              if all_issues:
                  debugs = [
                      e for e in all_issues if e.level < checks.INFO and not e.is_silenced()
                  ]
                  infos = [
      Severity: Major
      Found in django/core/management/base.py - About 40 mins to fix

        Function run_from_argv has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def run_from_argv(self, argv):
                """
                Set up any environment changes requested (e.g., Python path
                and Django settings), then run this command. If the
                command raises a ``CommandError``, intercept it and print it sensibly
        Severity: Minor
        Found in django/core/management/base.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, stdout=None, stderr=None, no_color=False, force_color=False):
                self.stdout = OutputWrapper(stdout or sys.stdout)
                self.stderr = OutputWrapper(stderr or sys.stderr)
                if no_color and force_color:
                    raise CommandError("'no_color' and 'force_color' can't be used together.")
        Severity: Minor
        Found in django/core/management/base.py - About 25 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