Showing 294 of 518 total issues
Function validate_user
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_user(self, openid, registration_code=None):
if registration_code:
user = config.db.users.find_one({'wechat.registration_code': registration_code})
if user is None:
raise APIUnknownUserException('Invalid or expired registration link.')
- 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 upgrade_to_30_closure_analysis
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def upgrade_to_30_closure_analysis(coll_item, coll):
analyses = coll_item.get('analyses', [])
for analysis_ in analyses:
files = analysis_.get('files', [])
- 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
Avoid deeply nested control flow statements. Open
if file_.get('measurements'):
file_['measurements'].append(measurement)
else:
file_['measurements'] = [measurement]
if info and file_.get('type', '') == 'dicom':
Avoid deeply nested control flow statements. Open
if code is None:
code = 'unknown_subject'
subject['code'] = code
subject_dict[code] = subject
Function set_origin
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_origin(self, drone_request, job_context):
"""
Add an origin to the request object. Used later in request handler logic.
Pretty clear duplication of logic with superuser_request / drone_request;
- 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
Avoid deeply nested control flow statements. Open
if measurement:
f['measurements'] = [measurement]
if info:
Function dispatcher
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def dispatcher(router, request, response):
try:
if uwsgi is not None:
uwsgi.set_logvar('request_id', request.id)
except: # pylint: disable=bare-except
- 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 log_access
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def log_access(access_type, cont_kwarg='cont_name', cont_id_kwarg='cid', filename_kwarg='name'):
"""
A decorator to log a user or drone's access to an endpoint
"""
def log_access_decorator(handler_method):
- 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 _upsert_container
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _upsert_container(cont, cont_type, parent, parent_type, upload_type, timestamp):
Function update_el
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_el(self, _id, payload, unset_payload=None, recursive=False, r_payload=None, replace_metadata=False):
Function get_parent_tree
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_parent_tree(self, _id, cont=None, projection=None, add_self=False):
parents = []
curr_storage = self
- 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 update_el
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_el(self, _id, payload, unset_payload=None, recursive=False, r_payload=None, replace_metadata=False):
Avoid deeply nested control flow statements. Open
if file_:
file_['input'] = True
files.append(file_)
Avoid deeply nested control flow statements. Open
if modality:
f['modality'] = modality
Function _find_or_create_destination_project
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _find_or_create_destination_project(group_id, project_label, timestamp, user):
group_id, project_label = _group_id_fuzzy_match(group_id, project_label)
group = config.db.groups.find_one({'_id': group_id})
if project_label == '':
- 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 update_el
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_el(self, _id, payload, unset_payload=None, recursive=False, r_payload=None, replace_metadata=False):
Avoid deeply nested control flow statements. Open
if info:
f['info'] = info
if modality:
Function update_el
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_el(self, _id, payload, unset_payload=None, recursive=False, r_payload=None, replace_metadata=False):
Avoid deeply nested control flow statements. Open
for an in analyses:
files = an.pop('files', [])
doc = {
'analysis': an,
'session': s,
Avoid deeply nested control flow statements. Open
if 'deleted' in f or not check_cont(f, fr_temp):
# Didn't find a match, on to the next one
continue
else:
count += 1