Showing 5 of 7 total issues
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
Function lookups
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def lookups(self, request, model_admin):
sep = "_"
names = list(set(Setting.objects.all().values_list("name", flat=True)))
names_count = len(names)
names_parts = [name.split(sep) for name in names]
- Read upRead up
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 register_extra_settings_admin
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def register_extra_settings_admin(
app,
queryset_processor=None,
unregister_default=True,
):
- Read upRead up
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 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
- Read upRead up
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:
- Read upRead up
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"