Showing 67 of 71 total issues
Function get_c2d_environments
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_c2d_environments(flat=False):
if not os.getenv("OPERATOR_SERVICE_URL"):
return []
standard_headers = {"Content-Type": "application/json", "Connection": "close"}
- 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_redirect
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_redirect(url, redirect_count=0):
if not is_url(url):
return None
if redirect_count > 5:
- 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 verify_order_tx
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def verify_order_tx(
Function _decrypt
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _decrypt(
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
Function validate_and_create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_and_create(file_obj) -> Tuple[bool, Any]:
if not file_obj:
return False, "cannot decrypt files for this service."
try:
- 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 send_proof
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_proof(
Function get_provider_fees_or_remote
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_provider_fees_or_remote(
Function validate_order
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def validate_order(
Function preliminary_algo_validation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def preliminary_algo_validation(self):
algo_data = self.data["algorithm"]
algorithm_did = algo_data.get("documentId")
algorithm_service_id = algo_data.get("serviceId")
algorithm_meta = algo_data.get("meta")
- 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 record_consume_request
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def record_consume_request(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
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 "",
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 "",
Function validate_transfer_not_used_for_other_service
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def validate_transfer_not_used_for_other_service(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function send_proof
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def send_proof(
chain_id,
order_tx_id,
provider_data,
consumer_data,
- 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_nonce
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_nonce(address, nonce_value):
"""
Updates the value of `nonce` in the database
:param: address
:param: nonce_value
- 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 validate_dns_record
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_dns_record(record, domain, record_type):
value = record if isinstance(record, str) else record.to_text().strip()
allow_non_public_ip = bool_value_of_env("ALLOW_NON_PUBLIC_IP")
try:
- 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 error_response(f"Provider {network_name}: " + message, 400, logger)