Showing 4 of 10 total issues
File admin.py
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.exceptions import PermissionDenied
Function recover_view
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def recover_view(self, request, version_id, extra_context=None):
if not self.has_change_permission(request):
raise PermissionDenied()
version = get_object_or_404(Version, pk=unquote(version_id))
- 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 _create_aldryn_revision
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _create_aldryn_revision(self, target, user=None,
comment=None, source=None):
#
# _get_attached_objects returns the models which define the
# PlaceholderField to which this placeholder is linked. Theoretically it
- 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_fk_models
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_fk_models(obj, blank=None):
"""
Returns a list of tuples (FK model, `blank`) for FK relations on a given
object model. If blank is provided - filters by `blank` attribute value.
:param obj: object to check FK relations
- 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"