Showing 12 of 12 total issues
Class Client
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Client < EM::Connection
include EM::Deferrable
include Utilities
attr_accessor :logger, :sentinel, :auto_reconnect, :reconnect_on_error
Method resolve
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def resolve(&block)
sentinel = select_a_sentinel
if sentinel.nil?
if @logger
@logger.debug("unable to determine redis master", {
- 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
File client.rb
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "sensu/redis/client/constants"
require "sensu/redis/client/errors"
require "sensu/redis/utilities"
require "eventmachine"
Method dispatch_response
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def dispatch_response(value)
if @multibulk_count
@multibulk_values << value
@multibulk_count -= 1
if @multibulk_count == 0
- 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 resolve
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resolve(&block)
sentinel = select_a_sentinel
if sentinel.nil?
if @logger
@logger.debug("unable to determine redis master", {
Method parse_response_line
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_response_line(line)
# Trim off the response type and delimiter (\r\n).
response = line.slice(1..-3)
# First character indicates response type.
case line[0, 1]
Method authenticate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def authenticate
if @password
send_command(AUTH_COMMAND, @password) do |authenticated|
if authenticated
yield if block_given?
- 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 resolve_hostname
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def resolve_hostname(host, &block)
resolve = Proc.new do
begin
info = case RUBY_PLATFORM
when /linux/
- 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 parse_response_line
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_response_line(line)
# Trim off the response type and delimiter (\r\n).
response = line.slice(1..-3)
# First character indicates response type.
case line[0, 1]
- 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 reconnect!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def reconnect!
@reconnect_callbacks[:before].call unless @reconnecting
@reconnecting = true
EM.add_timer(1) do
determine_address do |host, port|
- 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 unbind
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def unbind
@deferred_status = nil
@pubsub_callbacks = nil
if @closing
@reconnecting = false
- 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 connect_to_sentinel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def connect_to_sentinel(options={})
options[:host] ||= "127.0.0.1"
options[:port] ||= 26379
resolve_host(options[:host]) do |ip_address|
if ip_address.nil?
- 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"