Showing 5 of 5 total issues
File utils.py
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
from copy import copy
from typing import Type, Optional, Dict, Tuple
from django.conf import settings
from django.contrib.admin.options import ModelAdmin
Function hierarchy_nav
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def hierarchy_nav(self, obj: Model) -> str:
"""Renders hierarchy navigation elements (folders)."""
result_repr = '' # For items without children.
ch_count = getattr(obj, Hierarchy.CHILD_COUNT_MODEL_ATTR, 0)
- 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 __init__
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, request, model, list_display, list_display_links,
Function hook_get_results
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def hook_get_results(self, changelist: 'HierarchicalChangeList'):
"""Triggered by `ChangeList.get_results()`."""
# Poor NestedSet guys they've punished themselves once chosen that approach,
# and now we punish them again with all those DB hits.
- 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 hook_get_results
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def hook_get_results(self, changelist: 'HierarchicalChangeList'):
"""Triggered by `ChangeList.get_results()`."""
result_list = list(changelist.result_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"