Function _upload_media
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def _upload_media(task_handle, event_id, base_path):
"""
Actually uploads the resources
"""
global UPLOAD_QUEUE
- Read upRead up
- Create a ticketCreate a ticket
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 import_helpers.py
has 335 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import os
import shutil
import traceback
import uuid
- Create a ticketCreate a ticket
Function _fix_related_fields
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _fix_related_fields(srv, data, service_ids):
"""
Fixes the ids services which are related to others.
Like track, format -> session
Also fixes their schema
- Read upRead up
- Create a ticketCreate a ticket
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_file_from_request
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_file_from_request(ext=None, folder=None, name='file'):
"""
Get file from a request, save it locally and return its path
"""
if ext is None:
- Read upRead up
- Create a ticketCreate a ticket
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_service_from_json
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_service_from_json(task_handle, data, srv, event_id, service_ids=None):
- Create a ticketCreate a ticket
Function _upload_media_queue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _upload_media_queue(srv, obj):
"""
Add media uploads to queue
"""
global UPLOAD_QUEUE
- Read upRead up
- Create a ticketCreate a ticket
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 import_event_json
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def import_event_json(task_handle, zip_path, creator_id):
"""
Imports and creates event from json zip
"""
global CUR_ID, UPLOAD_QUEUE
- Read upRead up
- Create a ticketCreate a ticket
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 _delete_fields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _delete_fields(srv, data):
"""
Delete not needed fields in POST request
"""
if srv[0] in DELETE_FIELDS:
- Read upRead up
- Create a ticketCreate a ticket
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"