Showing 333 of 491 total issues

Method ev_set_latency_avg_calc_rule has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def ev_set_latency_avg_calc_rule(s)
        #check argument
        if /^on$|^off$/ !~ s[1]
          return send_data("CLIENT_ERROR argument 1: please input \"on\" or \"off\"\r\n")
        elsif s[1] == "on" && (s.length <= 3 || s[2].to_i < 1)
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 randomly_change_nid! has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def randomly_change_nid!(idx, from, to, repethost = false)
        vns = []
        v_idx.each_pair do |vn, nids|
          cnt = 0
          nids.each_with_index do |nid, i|
Severity: Minor
Found in lib/roma/routing/random_balancer.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 select_vn_for_join has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def select_vn_for_join(exclude_nodes, rep_host)
        short_idx = {}
        myhost_idx = {}
        idx = {}
        myhost = exclude_nodes[0].split(/[:_]/)[0]
Severity: Minor
Found in lib/roma/routing/random_partitioner.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 timer_event_10sec has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def timer_event_10sec
      if @startup && @rttable.enabled_failover == false
        @log.debug("nodes_check start")
        nodes=@rttable.nodes
        nodes.delete(@stats.ap_str)
Severity: Minor
Found in lib/roma/romad.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

File tribunus.rb has 251 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'socket'
require 'ipaddr'
require 'optparse'
UDP_PORT=14329
MULTICAST_ADDR="225.0.0.123"
Severity: Minor
Found in lib/roma/tools/tribunus.rb - About 2 hrs to fix

    Method ev_delete has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def ev_delete(s)
            if s.length < 2
              @log.error("delete:wrong number of arguments(#{s})")
              return send_data("CLIENT_ERROR Wrong number of arguments.\r\n")
            end
    Severity: Minor
    Found in lib/roma/plugin/plugin_storage.rb - About 1 hr to fix

      Method set_db_stat has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def set_db_stat(dn, stat)
              @stat_lock.synchronize do
                case @dbs[dn]
                when :normal
                  @each_vn_dump_vnodes.each do |vn|
      Severity: Minor
      Found in lib/roma/storage/basic_storage.rb - About 1 hr to fix

        Method initialize_rttable has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def initialize_rttable
              if @stats.join_ap
                initialize_rttable_join
              else
                fname = "#{Roma::Config::RTTABLE_PATH}/#{@stats.ap_str}.route"
        Severity: Minor
        Found in lib/roma/romad.rb - About 1 hr to fix

          Method options has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def options(argv)
                opts = OptionParser.new
                opts.banner="usage:#{File.basename($0)} [options] address"
          
                @stats.daemon = false
          Severity: Minor
          Found in lib/roma/romad.rb - About 1 hr to fix

            Method ev_alist_expired_swap_and_insert has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                  def ev_alist_expired_swap_and_insert(s)
                    hname, k, d, vn, nodes = calc_hash(s[1])
                    data = read_bytes(s[3].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 1 hr 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_insert has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                  def ev_alist_expired_swap_and_sized_insert(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 1 hr 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_push has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                  def ev_alist_expired_swap_and_push(s)
                    hname, k, d, vn, nodes = calc_hash(s[1])
                    data = read_bytes(s[3].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 1 hr 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_delete_at has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

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

                  def ev_get_expt(s)
                    unless s.length.between?(2, 3)
                      @log.error("get_expt: wrong number of arguments(#{s.length-1} to 2-3)")
                      return send_data("CLIENT_ERROR Wrong number of arguments.\r\n")
                    end
            Severity: Minor
            Found in lib/roma/plugin/plugin_storage.rb - About 1 hr 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_update_at has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                  def ev_alist_update_at(s)
                    hname, k, d, vn, nodes = calc_hash(s[1])
                    data = read_bytes(s[3].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 1 hr 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_expt has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                  def ev_set_expt(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 1 hr 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_swap_and_sized_push has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                  def ev_alist_swap_and_sized_push(s)
                    hname, k, d, vn, nodes = calc_hash(s[1])
                    data = read_bytes(s[3].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 1 hr 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 set_options has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                  def set_options(hdb)
                    prop = parse_options
            
                    prop.each_key{|k|
                      unless /^(bnum|apow|fpow|opts|xmsiz|rcnum|dfunit)$/ =~ k
            Severity: Minor
            Found in lib/roma/storage/tc_storage.rb - About 1 hr 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 each_clean_up has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                  def each_clean_up(t, vnhash)
                    @do_clean_up = true
                    nt = Time.now.to_i
                    @hdb.each{ |hdb|
                      delkey = []
            Severity: Minor
            Found in lib/roma/storage/dbm_storage.rb - About 1 hr 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 forward1 has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def forward1(nid, rs, data=nil)
                    if rs.last == "forward"
                      return send_data("SERVER_ERROR Routing table is inconsistent.\r\n")
                    end
                    
            Severity: Minor
            Found in lib/roma/plugin/plugin_alist.rb - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language