django/django

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

Summary

Maintainability
D
1 day
Test Coverage

Function handle has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

    def handle(self, app_or_project, name, target=None, **options):
        self.app_or_project = app_or_project
        self.a_or_an = 'an' if app_or_project == 'app' else 'a'
        self.paths_to_remove = []
        self.verbosity = options['verbosity']
Severity: Minor
Found in django/core/management/templates.py - About 1 day 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 templates.py has 287 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import cgi
import mimetypes
import os
import posixpath
import shutil
Severity: Minor
Found in django/core/management/templates.py - About 2 hrs to fix

    Function download has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def download(self, url):
            """
            Download the given URL and return the file name.
            """
            def cleanup_url(url):
    Severity: Minor
    Found in django/core/management/templates.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 handle_template has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def handle_template(self, template, subdir):
            """
            Determine where the app or project templates are.
            Use django.__path__[0] as the default because the Django install
            directory isn't known.
    Severity: Minor
    Found in django/core/management/templates.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