forward3d/rbhive

View on GitHub
lib/rbhive/t_c_l_i_connection.rb

Summary

Maintainability
D
1 day
Test Coverage

Class TCLIConnection has 43 methods (exceeds 20 allowed). Consider refactoring.
Open

  class TCLIConnection
    attr_reader :client

    def initialize(server, port = 10_000, options = {}, logger = StdOutLogger.new)
      options ||= {} # backwards compatibility
Severity: Minor
Found in lib/rbhive/t_c_l_i_connection.rb - About 5 hrs to fix

    File t_c_l_i_connection.rb has 334 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    old_verbose, $VERBOSE = $VERBOSE, nil
    
    raise 'Thrift is not loaded' unless defined?(Thrift)
    raise 'RBHive is not loaded' unless defined?(RBHive)
    
    
    Severity: Minor
    Found in lib/rbhive/t_c_l_i_connection.rb - About 4 hrs to fix

      Method initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      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?
      Severity: Minor
      Found in lib/rbhive/t_c_l_i_connection.rb - About 45 mins to fix

      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

          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)}"
      Severity: Minor
      Found in lib/rbhive/t_c_l_i_connection.rb - About 35 mins to fix

      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

              return :closed
      Severity: Major
      Found in lib/rbhive/t_c_l_i_connection.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return :error
        Severity: Major
        Found in lib/rbhive/t_c_l_i_connection.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return :state_not_in_protocol
          Severity: Major
          Found in lib/rbhive/t_c_l_i_connection.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return :pending
            Severity: Major
            Found in lib/rbhive/t_c_l_i_connection.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return :unknown
              Severity: Major
              Found in lib/rbhive/t_c_l_i_connection.rb - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status