Showing 44 of 92 total issues
Function _get_11paths_serialized_headers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _get_11paths_serialized_headers(x_headers):
"""
Prepares and returns a string ready to be signed from the 11-paths specific HTTP headers
received.
- 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 put
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def put(
Function parse
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def parse(xml_input, encoding=None, expat=expat, process_namespaces=False,
Function patch
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def patch(
Function post
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def post(
Function request_from_context
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def request_from_context(context):
"""
Do http requests from context.
:param context: request context.
- 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_url
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def generate_url(scheme=None, host=None, port=None, path=None, query=None):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, headers=None, status=None, status_text=None, http_version=None, body=None):
Function log_print_request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def log_print_request(method, url, query_params=None, headers=None, body=None):
Function generate_url_path
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def generate_url_path(
Function unparse
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def unparse(input_dict, output=None, encoding='utf-8', full_document=True,
Function to_key_val_list
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_key_val_list(value, sort=False, insensitive=False):
"""
Take an object and test to see if it can be represented as a
dictionary. If it can be, return a list of tuples, e.g.,
::
- 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 apply_authentication
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def apply_authentication(self, context):
context.headers[X_11PATHS_DATE_HEADER_NAME] = self.utc or _get_utc()
if context.method == POST_METHOD or context.method == PUT_METHOD:
if CONTENT_TYPE_HEADER_NAME in context.headers and \
context.headers[CONTENT_TYPE_HEADER_NAME].lower().startswith(
- 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 too many return
statements within this function. Open
return str(data).encode(charset) if charset else str(data),\
Avoid too many return
statements within this function. Open
return data, self.content_type
Avoid too many return
statements within this function. Open
return b'\n'.join(results), self.get_content_type(charset)
Avoid too many return
statements within this function. Open
return b"\n".join(results), self.get_content_type(charset)
Avoid too many return
statements within this function. Open
return urlencode(data, doseq=False), self.content_type
Avoid too many return
statements within this function. Open
return '&'.join(results), self.content_type
Avoid too many return
statements within this function. Open
return b'\n'.join(result), self.get_content_type(charset)