fabiocaccamo/django-extra-settings

View on GitHub
extra_settings/models.py

Summary

Maintainability
A
3 hrs
Test Coverage

File models.py has 261 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from decimal import Decimal

from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
Severity: Minor
Found in extra_settings/models.py - About 2 hrs to fix

    Function set_defaults has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def set_defaults(cls, defaults):
            if not isinstance(defaults, list):
                raise ValueError("Setting 'defaults' must be a list of dicts items.")
            if not defaults:
                return
    Severity: Minor
    Found in extra_settings/models.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 get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def get(cls, name, default=None):
            val = cls._get_from_cache(name)
            if val is None:
                val = cls._get_from_database(name)
                if val is None:
    Severity: Minor
    Found in extra_settings/models.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