lib/poseidon/partition_consumer.rb
Method fetch
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
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
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
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
Open
def initialize(client_id, host, port, topic, partition, offset, options = {})
Method consumer_for_partition
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def self.consumer_for_partition(client_id, seed_brokers, topic, partition, offset, options = {})