Showing 333 of 491 total issues

Method start has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def start
      # config version check
      if !Config.const_defined?(:VERSION)
        @log.error("ROMA FAIL TO BOOT! : config.rb's version is too old.")
        exit
Severity: Major
Found in lib/roma/romad.rb - About 4 hrs to fix

    File cb_rttable.rb has 331 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'roma/routing/rttable'
    require 'roma/routing/random_partitioner'
    
    module Roma
      module Routing
    Severity: Minor
    Found in lib/roma/routing/cb_rttable.rb - About 3 hrs to fix

      Method set_db_stat has a Cognitive Complexity of 27 (exceeds 5 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 3 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 asyncev_start_auto_recover_process has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          def asyncev_start_auto_recover_process(args)
            @log.debug("#{__method__} #{args.inspect}")
            # ##run_join don't have possibility to be true in this case.
            # if @stats.run_join
            #  @log.error("#{__method__}:join process running")
      Severity: Minor
      Found in lib/roma/async_process.rb - About 3 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

      Class RLogger has 29 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class RLogger
            VERSION = '0.0.1'
            
            module Severity
              TRACE = -1
      Severity: Minor
      Found in lib/roma/logging/rlogger.rb - About 3 hrs to fix

        Method ev_alist_spushv has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

              def ev_alist_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: Minor
        Found in lib/roma/plugin/plugin_alist.rb - About 3 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 sync_a_vnode has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def sync_a_vnode(vn, to_nid, is_primary = nil)
              nids = @rttable.search_nodes(vn)
        
              if nids.include?(to_nid) == false || (is_primary && nids[0] != to_nid)
                @log.debug("#{__method__}:#{vn} #{to_nid} #{is_primary}")
        Severity: Minor
        Found in lib/roma/async_process.rb - About 3 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 acquired_recover_process has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def acquired_recover_process
              @log.info("#{__method__}:start")
        
              exclude_nodes = @rttable.exclude_nodes_for_recover(@stats.ap_str, @stats.rep_host)
        
        
        Severity: Minor
        Found in lib/roma/async_process.rb - About 3 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 each_clean_up has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

                def each_clean_up(t, vnhash)
                  @do_clean_up = true
                  nt = Time.now.to_i
                  @hdb.each{ |hdb|
                    keys = hdb.keys
        Severity: Minor
        Found in lib/roma/storage/rh_storage.rb - About 3 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

        Class Romad has 28 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Romad
            include AsyncProcess
            include WriteBehindProcess
        
            attr :storages
        Severity: Minor
        Found in lib/roma/romad.rb - About 3 hrs to fix

          Method initialize_rttable has a Cognitive Complexity of 23 (exceeds 5 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 3 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 options has a Cognitive Complexity of 23 (exceeds 5 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 3 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 sync_a_vnode_for_release has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              def sync_a_vnode_for_release(vn, to_nid, new_nids)
                nids = @rttable.search_nodes(vn)
          
                if nids.include?(to_nid) == false
                  @log.debug("#{__method__}:#{vn} #{to_nid}")
          Severity: Minor
          Found in lib/roma/async_process.rb - About 3 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 a Cognitive Complexity of 22 (exceeds 5 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: Minor
          Found in lib/roma/async_process.rb - About 3 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 recoverlost_lib.rb has 291 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'roma/client/sender'
          require 'roma/messaging/con_pool'
          require 'roma/routing/routing_data'
          
          module Roma
          Severity: Minor
          Found in lib/roma/tools/recoverlost_lib.rb - About 3 hrs to fix

            Method ev_delete has a Cognitive Complexity of 21 (exceeds 5 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 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 async_process_loop has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                def async_process_loop
                  loop do
                    while msg = @@async_queue.pop
                      if send("asyncev_#{msg.event}", msg.args)
                        msg.callback.call(msg, true) if msg.callback
            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 async_process_loop_for_latency has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                def async_process_loop_for_latency
                  loop do
                    while msg = @@async_queue_latency.pop
                      if send("asyncev_#{msg.event}", msg.args)
                        msg.callback.call(msg, true) if msg.callback
            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 leave has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                  def leave(nid)
                    unless @enabled_failover
                      return
                    end
                    return unless @rd.nodes.include?(nid)
            Severity: Minor
            Found in lib/roma/routing/cb_rttable.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_to_json has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                  def ev_alist_to_json(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

            Severity
            Category
            Status
            Source
            Language