File provider.py
has 3295 lines of code (exceeds 250 allowed). Consider refactoring. Open
import base64
import dataclasses
import datetime
import json
import logging
Function on_after_state_load
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def on_after_state_load(self):
self.lambda_service = LambdaService()
self.router.lambda_service = self.lambda_service
for account_id, account_bundle in lambda_stores.items():
- 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_layers
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def _validate_layers(self, new_layers: list[str], region: str, account_id: str):
if len(new_layers) > LAMBDA_LAYERS_LIMIT_PER_FUNCTION:
raise InvalidParameterValueException(
"Cannot reference more than 5 layers.", Type="User"
)
- 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_fn_qualifier
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _resolve_fn_qualifier(resolved_fn: Function, qualifier: str | None) -> tuple[str, str]:
"""Attempts to resolve a given qualifier and returns a qualifier that exists or
raises an appropriate ResourceNotFoundException.
:param resolved_fn: The resolved lambda function
- 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 add_layer_version_permission
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_layer_version_permission(
Function publish_layer_version
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def publish_layer_version(
Function update_alias
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_alias(
Function invoke
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def invoke(
Function create_alias
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_alias(
Function update_function_event_invoke_config
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_function_event_invoke_config(
Function put_function_event_invoke_config
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_function_event_invoke_config(
Function update_function_url_config
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_function_url_config(
Function list_functions
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_functions(
Function list_layer_versions
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_layer_versions(
Function create_function_url_config
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_function_url_config(
Function _create_version_model
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _create_version_model(
self,
function_name: str,
region: str,
account_id: 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 list_layers
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_layers(
Function remove_layer_version_permission
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def remove_layer_version_permission(
Function publish_version
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def publish_version(
Function _create_version_model
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_version_model(
Function _publish_version_from_existing_version
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _publish_version_from_existing_version(
Function list_aliases
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_aliases(
Function update_code_signing_config
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_code_signing_config(
Function _publish_version_with_changes
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _publish_version_with_changes(
Function remove_permission
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def remove_permission(
Function list_event_source_mappings
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_event_source_mappings(
Function list_function_url_configs
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_function_url_configs(
Function list_provisioned_concurrency_configs
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_provisioned_concurrency_configs(
Avoid deeply nested control flow statements. Open
if api_utils.qualifier_is_alias(provisioned_qualifier):
alias = fn.aliases.get(provisioned_qualifier)
resolved_version = fn.versions.get(alias.function_version)
fn_arn = resolved_version.id.qualified_arn()
elif api_utils.qualifier_is_version(provisioned_qualifier):
Function put_provisioned_concurrency_config
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_provisioned_concurrency_config(
Function create_code_signing_config
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_code_signing_config(
Function list_functions_by_code_signing_config
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_functions_by_code_signing_config(
Function list_versions_by_function
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_versions_by_function(
Function list_function_event_invoke_configs
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_function_event_invoke_configs(
Function get_function
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_function(
Function delete_alias
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def delete_alias(
Function get_function_url_config
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_function_url_config(
Function get_provisioned_concurrency_config
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_provisioned_concurrency_config(
Function put_function_concurrency
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_function_concurrency(
Function get_alias
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_alias(
Function delete_function_url_config
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def delete_function_url_config(
Function get_policy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_policy(
Function get_layer_version_policy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_layer_version_policy(
Function delete_function
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def delete_function(
Function tag_resource
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def tag_resource(
Function invoke_async
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def invoke_async(
Function get_function_event_invoke_config
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_function_event_invoke_config(
Function get_layer_version
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_layer_version(
Function delete_layer_version
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def delete_layer_version(
Function get_function_configuration
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_function_configuration(
Function put_function_code_signing_config
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_function_code_signing_config(
Function list_code_signing_configs
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_code_signing_configs(
Function untag_resource
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def untag_resource(
Function delete_provisioned_concurrency_config
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def delete_provisioned_concurrency_config(
Function delete_function_event_invoke_config
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def delete_function_event_invoke_config(