lib/poseidon/sync_producer.rb
Method send_messages
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def send_messages(messages)
return if messages.empty?
messages_to_send = MessagesToSend.new(messages, @cluster_metadata)
- 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
Method send_to_broker
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def send_to_broker(messages_for_broker)
return false if messages_for_broker.broker_id == -1
to_send = messages_for_broker.build_protocol_objects(@compression_config)
Poseidon.logger.debug { "Sending messages to broker #{messages_for_broker.broker_id}" }
- 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"