File provider.py
has 1004 lines of code (exceeds 250 allowed). Consider refactoring. Open
import base64
import json
import logging
from typing import Dict, List
from uuid import uuid4
Function subscribe
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
def subscribe(
self,
context: RequestContext,
topic_arn: topicARN,
protocol: String,
- 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 publish
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def publish(
self,
context: RequestContext,
message: String,
topic_arn: topicARN = 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 publish_batch
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def publish_batch(
self,
context: RequestContext,
topic_arn: topicARN,
publish_batch_request_entries: PublishBatchRequestEntryList,
- 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
SnsProvider
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class SnsProvider(SnsApi, ServiceLifecycleHook):
"""
Provider class for AWS Simple Notification Service.
AWS supports following operations in a cross-account setup:
Function publish
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def publish(
Function tag_resource
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def tag_resource(
self, context: RequestContext, resource_arn: AmazonResourceName, tags: TagList, **kwargs
) -> TagResourceResponse:
# each tag key must be unique
# https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html#tag-best-practices
- 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_subscription_attribute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_subscription_attribute(
attribute_name: str,
attribute_value: str,
topic_arn: str,
endpoint: 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 subscribe
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def subscribe(
Avoid deeply nested control flow statements. Open
if (new_attr := attributes.get(attr)) and sub.get(attr) != new_attr:
raise InvalidParameterException(
"Invalid parameter: Attributes Reason: Subscription already exists with different attributes"
)
Function create_topic
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_topic(
Function create_platform_endpoint
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_platform_endpoint(
Function confirm_subscription
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def confirm_subscription(
Function create_platform_application
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_platform_application(
Function validate_subscription_attribute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def validate_subscription_attribute(
Function set_subscription_attributes
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_subscription_attributes(
Function set_subscription_attributes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_subscription_attributes(
self,
context: RequestContext,
subscription_arn: subscriptionARN,
attribute_name: attributeName,
- 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"