lib/rbhive/t_c_l_i_connection.rb
Class TCLIConnection
has 43 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class TCLIConnection
attr_reader :client
def initialize(server, port = 10_000, options = {}, logger = StdOutLogger.new)
options ||= {} # backwards compatibility
File t_c_l_i_connection.rb
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
old_verbose, $VERBOSE = $VERBOSE, nil
raise 'Thrift is not loaded' unless defined?(Thrift)
raise 'RBHive is not loaded' unless defined?(RBHive)
Method initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def initialize(server, port = 10_000, options = {}, logger = StdOutLogger.new)
options ||= {} # backwards compatibility
raise "'options' parameter must be a hash" unless options.is_a?(Hash)
if options[:transport] == :sasl and options[:sasl_params].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"
Further reading
Method async_fetch_in_batch
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def async_fetch_in_batch(handles, batch_size = 1000, &block)
raise "No block given for the batch fetch request!" unless block_given?
# Can't get data from an unfinished query
unless async_is_complete?(handles)
raise "Can't perform fetch on a query in state: #{async_state(handles)}"
- 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
Avoid too many return
statements within this method. Open
Open
return :closed
Avoid too many return
statements within this method. Open
Open
return :error
Avoid too many return
statements within this method. Open
Open
return :state_not_in_protocol
Avoid too many return
statements within this method. Open
Open
return :pending
Avoid too many return
statements within this method. Open
Open
return :unknown