Showing 333 of 491 total issues

Method ev_alist_join_with_time has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def ev_alist_join_with_time(s)
        hname, k, d, vn, nodes = calc_hash(s[1])
        data = read_bytes(s[2].to_i)
        read_bytes(2)
        return forward1(nodes[0], s, data) if nodes[0] != @nid
Severity: Minor
Found in lib/roma/plugin/plugin_alist.rb - About 2 hrs 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 ev_alist_gets_with_time has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def ev_alist_gets_with_time(s)
        hname, k, d, vn, nodes = calc_hash(s[1])
        return forward1(nodes[0], s) if nodes[0] != @nid

        ddata = @storages[hname].get(vn, k, 0)
Severity: Minor
Found in lib/roma/plugin/plugin_alist.rb - About 2 hrs 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 ev_alist_gets has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def ev_alist_gets(s)
        hname, k, d, vn, nodes = calc_hash(s[1])
        return forward1(nodes[0], s) if nodes[0] != @nid

        ddata = @storages[hname].get(vn, k, 0)
Severity: Minor
Found in lib/roma/plugin/plugin_alist.rb - About 2 hrs 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 ev_alist_join has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def ev_alist_join(s)
        hname, k, d, vn, nodes = calc_hash(s[1])
        data = read_bytes(s[2].to_i)
        read_bytes(2)
        return forward1(nodes[0], s, data) if nodes[0] != @nid
Severity: Minor
Found in lib/roma/plugin/plugin_alist.rb - About 2 hrs 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 storage_cachecleaning_process has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def storage_cachecleaning_process(hname, dn)
      count = 0
      rcount = 0
      st = @storages[hname]

Severity: Minor
Found in lib/roma/async_process.rb - About 2 hrs 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 def_write_command_with_key_value has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def def_write_command_with_key_value(cmd, idx_of_val_len, forward = :one_line, &block)
          define_method "ev_#{cmd}" do |s|
            return send_data("CLIENT_ERROR does not find key\r\n") if s.length < 2
            begin
              params = CommandParams.new
Severity: Major
Found in lib/roma/command/command_definition.rb - About 2 hrs to fix

    Class Handler has 24 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Handler < EventMachine::Connection
          @@ev_list={}
          def self.ev_list; @@ev_list; end
          @@system_commands={}
          def self.system_commands; @@system_commands; end
    Severity: Minor
    Found in lib/roma/event/handler.rb - About 2 hrs to fix

      File write_behind.rb has 275 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'thread'
      require 'roma/stats'
      require 'socket'
      require 'roma/messaging/con_pool'
      require 'timeout'
      Severity: Minor
      Found in lib/roma/write_behind.rb - About 2 hrs to fix

        Method def_write_command_with_key has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def def_write_command_with_key(cmd, forward = :one_line, &block)
                  define_method "ev_#{cmd}" do |s|
                    return send_data("CLIENT_ERROR does not find key\r\n") if s.length < 2
                    begin
                      params = CommandParams.new
        Severity: Major
        Found in lib/roma/command/command_definition.rb - About 2 hrs to fix

          Method upload_data2 has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              def upload_data2(hname, nid, keys)
                con = Roma::Messaging::ConPool.instance.get_connection(nid)
          
                cmd = "#{@pushv_cmd} #{hname} 0\r\n"
                con.write(cmd)
          Severity: Minor
          Found in lib/roma/tools/recoverlost_lib.rb - About 2 hrs 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 ev_spushv has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def ev_spushv(s)
                  if s.length != 3
                    @log.error("#{__method__}:wrong number of arguments(#{s})")
                    return send_data("CLIENT_ERROR Wrong number of arguments.\r\n")
                  end
          Severity: Major
          Found in lib/roma/command/vn_command_receiver.rb - About 2 hrs to fix

            Method ev_alist_to_s has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                  def ev_alist_to_s(s)
                    hname, k, d, vn, nodes = calc_hash(s[1])
                    return forward1(nodes[0], s) if nodes[0] != @nid
            
                    ddata = @storages[hname].get(vn, k, 0)
            Severity: Minor
            Found in lib/roma/plugin/plugin_alist.rb - About 2 hrs 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 store_result has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                def store_result(results, base, hash, input)
                  target = base[hash]
            
                  return results if !target["name"]
            
            
            Severity: Minor
            Found in lib/roma/tools/mkconfig.rb - About 2 hrs 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 get_point has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def get_point(f, target_time, type, latency_time = Time.now, current_pos = 0, new_pos = f.size / 2)
                  # hilatency check
                  ps = Time.now - latency_time
                  if ps > 5
                    @log.warn('gather_logs process was failed.')
            Severity: Major
            Found in lib/roma/async_process.rb - About 2 hrs to fix

              File rt_command_receiver.rb has 261 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Roma
                module Command
              
                  module RoutingCommandReceiver
              
              
              Severity: Minor
              Found in lib/roma/command/rt_command_receiver.rb - About 2 hrs to fix

                Method ev_rswitch_replication has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                      def ev_rswitch_replication(s)
                        unless s.length.between?(2, 4)
                          return send_data("CLIENT_ERROR number of arguments\n\r")
                        end
                        unless s[1] =~ /^(true|false)$/
                Severity: Minor
                Found in lib/roma/command/sys_command_receiver.rb - About 2 hrs 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 ev_set_storage_status has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                      def ev_set_storage_status(s)
                        if s.length < 3
                          return send_data("CLIENT_ERROR number of arguments (#{s.length - 1} for 2)\r\n")
                        end
                
                
                Severity: Minor
                Found in lib/roma/command/sys_command_receiver.rb - About 2 hrs 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 def_command_with_key_value has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                        def def_command_with_key_value(cmd, idx_of_val_len, forward = :one_line, &block)
                          define_method "ev_#{cmd}" do |s|
                            return send_data("CLIENT_ERROR does not find key\r\n") if s.length < 2
                            begin
                              params = CommandParams.new
                Severity: Minor
                Found in lib/roma/command/command_definition.rb - About 2 hrs 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 ev_alist_expired_swap_and_sized_push has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                      def ev_alist_expired_swap_and_sized_push(s)
                        hname, k, d, vn, nodes = calc_hash(s[1])
                        data = read_bytes(s[4].to_i)
                        read_bytes(2)
                        return forward2(nodes[0], s, data) if nodes[0] != @nid
                Severity: Minor
                Found in lib/roma/plugin/plugin_alist.rb - About 2 hrs 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 ev_fdelete has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                      def ev_fdelete(s)
                        key,hname = s[1].split("\e")
                        hname ||= @defhash
                        d = Digest::SHA1.hexdigest(key).hex % @rttable.hbits
                        vn = @rttable.get_vnode_id(d)
                Severity: Minor
                Found in lib/roma/plugin/plugin_storage.rb - About 2 hrs 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

                Severity
                Category
                Status
                Source
                Language