File provider.py
has 1524 lines of code (exceeds 250 allowed). Consider refactoring. Open
import copy
import hashlib
import json
import logging
import re
Function create_queue
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def create_queue(
self,
context: RequestContext,
queue_name: String,
attributes: QueueAttributeMap = 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 check_attributes
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def check_attributes(message_attributes: MessageBodyAttributeMap):
if not message_attributes:
return
for attribute_name in message_attributes:
if len(attribute_name) >= 256:
- 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 _run
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def _run(self, move_task: MessageMoveTask):
try:
if move_task.destination_arn:
LOG.info(
"Move task started %s (%s -> %s)",
- 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 _collect_messages
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _collect_messages(
self, queue: SqsQueue, show_invisible: bool = False, show_delayed: bool = False
) -> List[Message]:
"""
Retrieves from a given SqsQueue all visible messages without causing any side effects (not setting any
- 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 receive_message
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def receive_message(
Function send_message
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_message(
Function _put_message
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def _put_message(
Function do_update_all_queues
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def do_update_all_queues(self):
for queue in self.iter_queues():
try:
queue.requeue_inflight_messages()
except Exception:
- 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_permission
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_permission(
Function create_queue
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_queue(
Function list_queues
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_queues(
Function dispatch_sqs_metric
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def dispatch_sqs_metric(
Function change_message_visibility
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def change_message_visibility(
Avoid deeply nested control flow statements. Open
if queue.attributes.get(k) != v:
LOG.debug(
"queue attribute values %s for queue %s do not match %s (existing) != %s (new)",
k,
queue_name,
Function list_dead_letter_source_queues
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_dead_letter_source_queues(
Function start_message_move_task
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def start_message_move_task(
Function change_message_visibility_batch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def change_message_visibility_batch(
Function get_queue_attributes
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_queue_attributes(
Function list_messages_for_queue_url
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_messages_for_queue_url(
Function _get_and_serialize_messages
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _get_and_serialize_messages(
Function get_queue_url
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_queue_url(
Function list_message_move_tasks
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_message_move_tasks(
Function tag_queue
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def tag_queue(self, context: RequestContext, queue_url: String, tags: TagMap, **kwargs) -> None:
Function _assert_batch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _assert_batch(
Function delete_message_batch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def delete_message_batch(
Function set_queue_attributes
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_queue_attributes(
Function untag_queue
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def untag_queue(
Function remove_permission
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def remove_permission(
Function send_message_batch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_message_batch(
Function delete_message
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def delete_message(
Function send_message_batch
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def send_message_batch(
self,
context: RequestContext,
queue_url: String,
entries: SendMessageBatchRequestEntryList,
- 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 receive_message
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def receive_message(
self,
context: RequestContext,
queue_url: String,
attribute_names: AttributeNameList = 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_approximate_cloudwatch_metrics
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def publish_approximate_cloudwatch_metrics(self):
"""Publishes the metrics for ApproximateNumberOfMessagesVisible, ApproximateNumberOfMessagesNotVisible
and ApproximateNumberOfMessagesDelayed to CloudWatch"""
# TODO ApproximateAgeOfOldestMessage is missing
# https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-available-cloudwatch-metrics.html
- 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"