Function get_categories
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def get_categories(
self,
parent_aliases: Optional[Union[str, List[str]]] = None,
target_object: 'ModelWithCategory' = None,
tied_only: bool = 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 _cache_init
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _cache_init(self):
"""Initializes local cache from Django cache if required."""
cache_ = cache.get(self.CACHE_ENTRY_NAME)
if cache_ 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"
Further reading
Function get_children_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_children_for(self, parent_alias: str = None, only_with_aliases: bool = False) -> List['CategoryBase']:
"""Returns a list with with categories under the given parent.
:param parent_alias: Parent category alias or None for categories under root
:param only_with_aliases: Flag to return only children with aliases
- 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"