Function check_details
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def check_details(self, with_checksum=False):
"""
If the url argument is invalid, returns False and empty dictionary.
Otherwise it returns True and a dictionary containing contentType and
contentLength. If the with_checksum flag is set to True, it also returns
- 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 build_download_response
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def build_download_response(
self,
request,
validate_url=True,
):
- 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_result_from_url
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _get_result_from_url(self, with_checksum=False):
func, func_args = self._get_func_and_args()
# overwrite checksum flag if file is too large
if with_checksum:
- 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
Consider simplifying this complex logical expression. Open
if content_type or content_length or file_name:
details = {
"contentLength": content_length or "",
"contentType": content_type or "",
"filename": file_name or "",