Showing 14 of 14 total issues
Class ProtocolStruct
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class ProtocolStruct < Struct
class EncodingError < StandardError;end
class DecodingError < StandardError;end
def self.new(hash)
Method read
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def read(buffer)
if self.class.prepend_size?
if !have_header?(buffer)
@truncated = true
return
- 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 read_member
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def read_member(buffer, member)
case type = type_map[member]
when Array
if self.class.size_bound_array?(member)
if @size
- 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_messages
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. 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 objects_with_errors
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def objects_with_errors
children = []
each_pair do |member, value|
case value
when Array
- 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 read
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read(buffer)
if self.class.prepend_size?
if !have_header?(buffer)
@truncated = true
return
Method fetch
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def fetch(options = {})
fetch_max_wait = options.delete(:max_wait_ms) || max_wait_ms
fetch_max_bytes = options.delete(:max_bytes) || max_bytes
fetch_min_bytes = options.delete(:min_bytes) || min_bytes
- 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 fetch
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fetch(options = {})
fetch_max_wait = options.delete(:max_wait_ms) || max_wait_ms
fetch_max_bytes = options.delete(:max_bytes) || max_bytes
fetch_min_bytes = options.delete(:min_bytes) || min_bytes
Method resolve_offset_if_necessary
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def resolve_offset_if_necessary
return unless Symbol === @offset || @offset < 0
protocol_offset = case @offset
when :earliest_offset
- 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 initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(client_id, host, port, topic, partition, offset, options = {})
Method consumer_for_partition
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.consumer_for_partition(client_id, seed_brokers, topic, partition, offset, options = {})
Method open
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.open(host, port, client_id, socket_timeout_ms, &block)
Method initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(compression_codec, compressed_topics)
if compression_codec
unless COMPRESSION_CODEC_MAP.has_key?(compression_codec)
raise ArgumentError, "Unknown compression codec: '#{compression_codec}' (accepted: #{COMPRESSION_CODEC_MAP.keys.inspect})"
end
- 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
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"