Showing 7 of 9 total issues
Function ajax_upload
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def ajax_upload(request, folder_id=None):
"""
Receives an upload from the uploader. Receives only one file at a time.
"""
mimetype = 'application/json' if request.is_ajax() else 'text/html'
- 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 load_aliases
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def load_aliases():
"""
Load ThumbnailOption as easy-thumbnails aliases
"""
def _load_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"
Further reading
Function _generate_thumbnails
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _generate_thumbnails(self, required_thumbnails):
_thumbnails = {}
for name, opts in iteritems(required_thumbnails):
try:
opts.update({'subject_location': self.subject_location})
- 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 _warn_node
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _warn_node(self, msg, node, *args, **kwargs):
Function render_tag
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def render_tag(self, context, source, options, async, varname):
Avoid too many return
statements within this function. Open
return HttpResponse(json.dumps({'error': str(e)}), status=500, **response_params)
Avoid too many return
statements within this function. Open
return HttpResponse(json.dumps({'error': str(e)}), status=500, **response_params)