Showing 16 of 16 total issues
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 get_linked_objects
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def get_linked_objects(
cls,
filter_kwargs: dict = None,
id_only: bool = False,
by_category: bool = False
- 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_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
File models.py
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import defaultdict
from typing import Union, Dict, List, Any
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
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 bootstrap_editors
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
bootstrap_editors: function() {
'use strict';
var cl_list_entry = '.' + this.defaults.classes.list_entry,
cl_choice_box = '.' + this.defaults.classes.choice_box,
Function make_cloud
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
make_cloud: function(target_el_id, font_size_min, font_size_max, font_size_units) {
'use strict';
var ties_max,
ties_min,
Function enable_editor
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def enable_editor(
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 render
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def render(self, context):
resolve = lambda arg: arg.resolve(context) if isinstance(arg, FilterExpression) else arg
target_obj = resolve(self.target_obj)
- 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 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 enable_category_lists_editor
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def enable_category_lists_editor(
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"
Further reading
Function get_ties_for_categories_qs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_ties_for_categories_qs(
cls,
categories: Union['CategoryBase', List['CategoryBase']],
user: 'User' = None,
status: int = 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"