File submission_worker.py
has 771 lines of code (exceeds 250 allowed). Consider refactoring. Open
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import contextlib
import importlib
Function main
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def main():
killer = GracefulKiller()
logger.info(
"{} Using {} as temp directory to store data".format(
WORKER_LOGS_PREFIX, BASE_TEMP_DIR
- 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 run_submission
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def run_submission(
challenge_id, challenge_phase, submission, user_annotation_file_path
):
"""
* receives a challenge id, phase id and user annotation file path
- 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 delete_old_temp_directories
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def delete_old_temp_directories(prefix='tmp'):
temp_dir = tempfile.gettempdir()
dir_creation_times = {}
- 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_or_create_sqs_queue
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_or_create_sqs_queue(queue_name, challenge=None):
"""
Returns:
Returns the SQS Queue object
"""
- 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 run_submission
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_submission(
challenge_id, challenge_phase, submission, user_annotation_file_path
):
"""
* receives a challenge id, phase id and user annotation file path
Avoid deeply nested control flow statements. Open
if (
current_running_submissions_count
== maximum_concurrent_submissions
):
pass
Function download_and_extract_file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def download_and_extract_file(url, download_location):
"""
* Function to extract download a file.
* `download_location` should include name of file as well.
"""
- 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 download_and_extract_zip_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def download_and_extract_zip_file(url, download_location, extract_location):
"""
* Function to extract download a zip file, extract it and then removes the zip file.
* `download_location` should include name of file as well.
"""
- 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"