File toolbox.py
has 369 lines of code (exceeds 250 allowed). Consider refactoring. Open
from inspect import getfullargspec
from collections import namedtuple
from typing import List, Callable, Union, Optional, Any, Tuple, Dict
from django.db.models import Model
Function action_add
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def action_add(cls, request: HttpRequest, category_list: CategoryList) -> 'CategoryBase':
"""Handles `add` action from CategoryList editor.
Returns CategoryModel object on success otherwise and exception from SitecatsException family is raised.
Adds an actual category if a target object is not set for the list.
- 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 enable_editor
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def enable_editor(
Function listen
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def listen(self) -> Any:
"""Instructs handler to listen to Django request and handle
CategoryList editor requests (if any).
Returns None on success otherwise and exception from SitecatsException family is raised.
- 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_lists
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def register_lists(
self,
category_lists: List[CategoryList],
lists_init_kwargs: Dict[str, Any] = None,
editor_init_kwargs: Dict[str, Any] = 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"
Further reading
Function get_category_lists
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_category_lists(
init_kwargs: dict = None,
additional_parents_aliases: List[str] = None,
obj: Model = 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"