File testutil.py
has 583 lines of code (exceeds 250 allowed). Consider refactoring. Open
import glob
import importlib
import io
import json
import os
Function create_lambda_archive
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def create_lambda_archive(
script: str,
get_content: bool = False,
libs: List[str] = None,
runtime: str = None,
- 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 find_object
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def find_object(expected_object, object_list):
for obj in object_list:
if isinstance(obj, list):
found = find_object(expected_object, obj)
if found:
- 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 find_recursive
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def find_recursive(key, value, obj):
if isinstance(obj, dict):
for k, v in obj.items():
if k == key and v == value:
return 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 create_lambda_function
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def create_lambda_function(
func_name,
zip_file=None,
event_source_arn=None,
handler_file=None,
- 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 create_lambda_function
has 18 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_lambda_function(
Function map_all_s3_objects
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def map_all_s3_objects(
s3_client, to_json: bool = True, buckets: str | List[str] = None
) -> Dict[str, Any]:
result = {}
buckets = ensure_list(buckets)
- 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_lambda_log_events
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_lambda_log_events(
function_name,
delay_time=DEFAULT_GET_LOG_EVENTS_DELAY,
regex_filter: Optional[str] = None,
log_group=None,
- 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 create_lambda_api_gateway_integration
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_lambda_api_gateway_integration(
Consider simplifying this complex logical expression. Open
if (
not raw_message
or raw_message.startswith("INIT_START")
or raw_message.startswith("START")
or raw_message.startswith("END")
Function connect_api_gateway_to_http_with_lambda_proxy
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def connect_api_gateway_to_http_with_lambda_proxy(
Function create_zip_file
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create_zip_file(
file_path: str,
zip_file: str = None,
get_content: bool = False,
content_root: str = None,
- 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 deeply nested control flow statements. Open
if os.path.isdir(file_path):
cp_r(file_path, name)
else:
shutil.copyfile(file_path, name)
Avoid deeply nested control flow statements. Open
if not find_recursive(k, v, obj):
all_ok = False
break
if all_ok:
Function create_lambda_archive
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_lambda_archive(
Avoid deeply nested control flow statements. Open
if exclude_func(relative):
rm_rf(full_name)
# create zip file
result = create_zip_file(tmp_dir, get_content=get_content)
Function create_zip_file
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_zip_file(
Function get_lambda_log_events
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_lambda_log_events(
Function connect_api_gateway_to_http_with_lambda_proxy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def connect_api_gateway_to_http_with_lambda_proxy(
gateway_name,
target_uri,
stage_name=None,
methods=None,
- 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"