File template_deployer.py
has 1237 lines of code (exceeds 250 allowed). Consider refactoring. Open
import base64
import json
import logging
import re
import traceback
Function _resolve_refs_recursively
has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring. Open
def _resolve_refs_recursively(
account_id: str,
region_name: str,
stack_name: str,
resources: dict,
- 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 resolve_refs_recursively
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def resolve_refs_recursively(
account_id: str,
region_name: str,
stack_name: str,
resources: dict,
- 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 resolve_placeholders_in_string
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def resolve_placeholders_in_string(
account_id: str,
region_name: str,
result,
stack_name: str,
- 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_stack
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def delete_stack(self):
if not self.stack:
return
self.stack.set_stack_status("DELETE_IN_PROGRESS")
stack_resources = list(self.stack.resources.values())
- 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 resolve_ref
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def resolve_ref(
account_id: str,
region_name: str,
stack_name: str,
resources: dict,
- 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_attr_from_model_instance
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_attr_from_model_instance(
resource: dict, attribute_name: str, resource_type: str, resource_id: str
) -> str:
properties = resource.get("Properties", {})
# if there's no entry in VALID_GETATT_PROPERTIES for the resource type we still default to "open" and accept anything
- 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 resolve_refs_recursively
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def resolve_refs_recursively(
Function _resolve_refs_recursively
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _resolve_refs_recursively(
Function construct_changes
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def construct_changes(
Function resolve_placeholders_in_string
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def resolve_placeholders_in_string(
Avoid deeply nested control flow statements. Open
if json_key not in json_secret:
raise DependencyNotYetSatisfied(
resource_ids=secret_id,
message=f"Key {json_key} is not yet available in secret {secret_id}.",
)
Function resolve_ref
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def resolve_ref(
Function apply_changes
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def apply_changes(
Function prepare_should_deploy_change
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def prepare_should_deploy_change(
Function apply_changes_in_loop
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def apply_changes_in_loop(
Avoid too many return
statements within this function. Open
return result
Avoid too many return
statements within this function. Open
return result
Avoid too many return
statements within this function. Open
return values[index]
Avoid too many return
statements within this function. Open
return azs
Avoid too many return
statements within this function. Open
return attribute_candidate
Avoid too many return
statements within this function. Open
return selected_map.get(first_level_attribute).get(second_level_attribute)
Avoid too many return
statements within this function. Open
return values[int(index)]
Avoid too many return
statements within this function. Open
return PLACEHOLDER_AWS_NO_VALUE
Avoid too many return
statements within this function. Open
return fn_equals_type_conversion(operand1) == fn_equals_type_conversion(operand2)
Avoid too many return
statements within this function. Open
return [p.strip() for p in parameter_value.split(",")]
Avoid too many return
statements within this function. Open
return resources[ref].get("PhysicalResourceId")
Avoid too many return
statements within this function. Open
return secret_value
Avoid too many return
statements within this function. Open
return string.split(delimiter)
Avoid too many return
statements within this function. Open
return account_id
Avoid too many return
statements within this function. Open
return conditions[value[keys_list[0]]]
Avoid too many return
statements within this function. Open
return AWS_URL_SUFFIX
Avoid too many return
statements within this function. Open
return resolve_refs_recursively(
Avoid too many return
statements within this function. Open
return stack_export["Value"]
Avoid too many return
statements within this function. Open
return None
Avoid too many return
statements within this function. Open
return result
Avoid too many return
statements within this function. Open
return to_str(base64.b64encode(to_bytes(value_to_encode)))
Avoid too many return
statements within this function. Open
return {}
Avoid too many return
statements within this function. Open
return value
Avoid too many return
statements within this function. Open
return match.group(0)
Avoid too many return
statements within this function. Open
return parameter_value
Avoid too many return
statements within this function. Open
return not condition