File publisher.py
has 1070 lines of code (exceeds 250 allowed). Consider refactoring. Open
import abc
import base64
import copy
import datetime
import hashlib
Function _publish
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def _publish(self, context: SnsBatchPublishContext, subscriber: SnsSubscription):
entries = []
sqs_system_attrs = create_sqs_system_attributes(context.request_headers)
# TODO: check ID, SNS rules are not the same as SQS, so maybe generate the entries ID
failure_map = {}
- 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 store_delivery_log
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def store_delivery_log(
message_context: SnsMessage,
subscriber: SnsSubscription,
success: bool,
topic_attributes: dict[str, 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 create_sns_message_body
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create_sns_message_body(
message_context: SnsMessage,
subscriber: SnsSubscription,
topic_attributes: dict[str, str] = None,
) -> 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 get_sqs_kwargs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_sqs_kwargs(msg_context: SnsMessage, subscriber: SnsSubscription):
kwargs = {}
if is_raw_message_delivery(subscriber) and msg_context.message_attributes:
kwargs["MessageAttributes"] = msg_context.message_attributes
- 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 store_delivery_log
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def store_delivery_log(
Function _publish
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _publish(self, context: SnsPublishContext, subscriber: SnsSubscription):
message_context = context.message
message_body = self.prepare_message(
message_context, subscriber, topic_attributes=context.topic_attributes
)
- 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"