lib/roma/async_process.rb

Summary

Maintainability
F
1 wk
Test Coverage

File async_process.rb has 926 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'thread'
require 'digest/sha1'
require 'timeout'

module Roma
Severity: Major
Found in lib/roma/async_process.rb - About 2 days to fix

    Method storage_clean_up_process has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        def storage_clean_up_process
          @log.info("#{__method__}:start")
          me = @stats.ap_str
          vnhash = {}
          @rttable.each_vnode do |vn, nids|
    Severity: Minor
    Found in lib/roma/async_process.rb - About 4 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 release_process has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

        def release_process
          @log.info("#{__method__}:start.")
    
          if @rttable.can_i_release?(@stats.ap_str, @stats.rep_host)
            @log.error("#{__method__}:Sufficient nodes do not found.")
    Severity: Minor
    Found in lib/roma/async_process.rb - About 4 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

    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 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 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

    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 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 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

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

          def join_process
            @log.info("#{__method__}:start")
            count = 0
            nv = @rttable.v_idx.length
            exclude_nodes = @rttable.exclude_nodes_for_join(@stats.ap_str, @stats.rep_host)
      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 balance_process has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def balance_process
            @log.info("#{__method__}:start")
            count = 0
            nv = @rttable.v_idx.length
            exclude_nodes = @rttable.exclude_nodes_for_balance(@stats.ap_str, @stats.rep_host)
      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 storage_clean_up_process has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def storage_clean_up_process
            @log.info("#{__method__}:start")
            me = @stats.ap_str
            vnhash = {}
            @rttable.each_vnode do |vn, nids|
      Severity: Minor
      Found in lib/roma/async_process.rb - About 1 hr to fix

        Method asyncev_start_auto_recover_process has 41 lines of code (exceeds 25 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 1 hr to fix

          Method sync_a_vnode has 40 lines of code (exceeds 25 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 1 hr to fix

            Method asyncev_calc_latency_average has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def asyncev_calc_latency_average(args)
                  latency, cmd = args
                  # @log.debug(__method__)
            
                  unless @stats.latency_data.key?(cmd) # only first execute target cmd
            Severity: Minor
            Found in lib/roma/async_process.rb - About 1 hr to fix

              Method sync_a_vnode_for_release has 32 lines of code (exceeds 25 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 1 hr to fix

                Method push_a_vnode_stream has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def push_a_vnode_stream(hname, vn, nid)
                      @log.debug("#{__method__}:hname=#{hname} vn=#{vn} nid=#{nid}")
                
                      stop_clean_up
                
                
                Severity: Minor
                Found in lib/roma/async_process.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 replicate_existing_data_process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def replicate_existing_data_process(args)
                      @log.info("#{__method__} :start.")
                
                      @storages.each_key do |hname|
                        @rttable.v_idx.each_key do |vn|
                Severity: Minor
                Found in lib/roma/async_process.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 push_a_vnode_stream has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def push_a_vnode_stream(hname, vn, nid)
                      @log.debug("#{__method__}:hname=#{hname} vn=#{vn} nid=#{nid}")
                
                      stop_clean_up
                
                
                Severity: Minor
                Found in lib/roma/async_process.rb - About 1 hr to fix

                  Method release_process has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def release_process
                        @log.info("#{__method__}:start.")
                  
                        if @rttable.can_i_release?(@stats.ap_str, @stats.rep_host)
                          @log.error("#{__method__}:Sufficient nodes do not found.")
                  Severity: Minor
                  Found in lib/roma/async_process.rb - About 1 hr to fix

                    Method get_routing_event has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_routing_event
                          @log.info("#{__method__}:start.")
                    
                          routing_path = Config::RTTABLE_PATH
                          f_list = Dir.glob("#{routing_path}/#{@stats.ap_str}*")
                    Severity: Minor
                    Found in lib/roma/async_process.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 edit_nodes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def edit_nodes(nodes, new_nid, is_primary)
                          if @rttable.rn == 1
                            return [new_nid]
                          end
                          # [node_a, node_b, new_nid]
                    Severity: Minor
                    Found in lib/roma/async_process.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 storage_cachecleaning_process has 27 lines of code (exceeds 25 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 1 hr to fix

                      Method req_push_a_vnode has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def req_push_a_vnode(vn, src_nid, is_primary)
                            con = Roma::Messaging::ConPool.instance.get_connection(src_nid)
                            con.write("reqpushv #{vn} #{@stats.ap_str} #{is_primary}\r\n")
                            res = con.gets # receive 'PUSHED\r\n' | 'REJECTED\r\n' | 'ERROR\r\n'
                            if res == "REJECTED\r\n"
                      Severity: Minor
                      Found in lib/roma/async_process.rb - About 1 hr to fix

                        Method asyncev_start_join_process has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def asyncev_start_join_process(_args)
                              @log.debug(__method__)
                              if @stats.run_join
                                @log.error("#{__method__}:join process running")
                                return true
                        Severity: Minor
                        Found in lib/roma/async_process.rb - About 1 hr to fix

                          Method req_push_a_vnode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def req_push_a_vnode(vn, src_nid, is_primary)
                                con = Roma::Messaging::ConPool.instance.get_connection(src_nid)
                                con.write("reqpushv #{vn} #{@stats.ap_str} #{is_primary}\r\n")
                                res = con.gets # receive 'PUSHED\r\n' | 'REJECTED\r\n' | 'ERROR\r\n'
                                if res == "REJECTED\r\n"
                          Severity: Minor
                          Found in lib/roma/async_process.rb - About 55 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 asyncev_calc_latency_average has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def asyncev_calc_latency_average(args)
                                latency, cmd = args
                                # @log.debug(__method__)
                          
                                unless @stats.latency_data.key?(cmd) # only first execute target cmd
                          Severity: Minor
                          Found in lib/roma/async_process.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 get_point has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def get_point(f, target_time, type, latency_time = Time.now, current_pos = 0, new_pos = f.size / 2)
                          Severity: Minor
                          Found in lib/roma/async_process.rb - About 45 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                  return true
                            Severity: Major
                            Found in lib/roma/async_process.rb - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                    return true
                              Severity: Major
                              Found in lib/roma/async_process.rb - About 30 mins to fix

                                Similar blocks of code found in 2 locations. 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: Major
                                Found in lib/roma/async_process.rb and 1 other location - About 1 hr to fix
                                lib/roma/async_process.rb on lines 102..125

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 73.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. 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: Major
                                Found in lib/roma/async_process.rb and 1 other location - About 1 hr to fix
                                lib/roma/async_process.rb on lines 77..100

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 73.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                      while @rttable.vnode_balance(@stats.ap_str) == :less && count < nv
                                        break unless @do_balance_process
                                
                                        vn, nodes, is_primary = @rttable.select_vn_for_balance(exclude_nodes, @stats.rep_host)
                                        unless vn
                                Severity: Major
                                Found in lib/roma/async_process.rb and 1 other location - About 1 hr to fix
                                lib/roma/async_process.rb on lines 396..411

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 57.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                      while @rttable.vnode_balance(@stats.ap_str) == :less && count < nv
                                        break unless @do_join_process
                                
                                        vn, nodes, is_primary = @rttable.select_vn_for_join(exclude_nodes, @stats.rep_host)
                                        unless vn
                                Severity: Major
                                Found in lib/roma/async_process.rb and 1 other location - About 1 hr to fix
                                lib/roma/async_process.rb on lines 426..441

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 57.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                      unless @rttable.nodes.include?(nid)
                                        @log.warn("async zredundant failed:#{nid} does not found in routing table.#{k}\e#{hname} #{d} #{clk} #{expt} #{zv.length}")
                                        return true # no retry
                                Severity: Minor
                                Found in lib/roma/async_process.rb and 1 other location - About 30 mins to fix
                                lib/roma/async_process.rb on lines 197..199

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 32.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                      unless @rttable.nodes.include?(nid)
                                        @log.warn("async redundant failed:#{nid} does not found in routing table.#{k}\e#{hname} #{d} #{clk} #{expt} #{v.length}")
                                        return true # no retry
                                Severity: Minor
                                Found in lib/roma/async_process.rb and 1 other location - About 30 mins to fix
                                lib/roma/async_process.rb on lines 212..214

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 32.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                        end_time = Time.mktime(Regexp.last_match[1], Regexp.last_match[2], Regexp.last_match[3], Regexp.last_match[4], Regexp.last_match[5], Regexp.last_match[6], Regexp.last_match[7])
                                Severity: Minor
                                Found in lib/roma/async_process.rb and 1 other location - About 25 mins to fix
                                lib/roma/async_process.rb on lines 992..992

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 31.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                        begining_time = Time.mktime(Regexp.last_match[1], Regexp.last_match[2], Regexp.last_match[3], Regexp.last_match[4], Regexp.last_match[5], Regexp.last_match[6], Regexp.last_match[7])
                                Severity: Minor
                                Found in lib/roma/async_process.rb and 1 other location - About 25 mins to fix
                                lib/roma/async_process.rb on lines 997..997

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 31.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                      res = async_send_cmd(nid, "rset #{k}\e#{hname} #{d} #{clk} #{expt} #{v.length}\r\n#{v}\r\n", 10)
                                Severity: Minor
                                Found in lib/roma/async_process.rb and 1 other location - About 20 mins to fix
                                lib/roma/async_process.rb on lines 216..216

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 27.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                          res = push_a_vnode_stream(hname, vn, to_nid)
                                          if res != 'STORED'
                                            @log.error("#{__method__}:push_a_vnode was failed:hname=#{hname} vn=#{vn}:#{res}")
                                            return false
                                Severity: Minor
                                Found in lib/roma/async_process.rb and 1 other location - About 20 mins to fix
                                lib/roma/async_process.rb on lines 1069..1072

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 27.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                            res = push_a_vnode_stream(hname, vn, replica_nid)
                                            if res != 'STORED'
                                              @log.error("#{__method__}:push_a_vnode was failed:hname=#{hname} vn=#{vn}:#{res}")
                                              return false
                                Severity: Minor
                                Found in lib/roma/async_process.rb and 1 other location - About 20 mins to fix
                                lib/roma/async_process.rb on lines 598..601

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 27.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                      res = async_send_cmd(nid, "rzset #{k}\e#{hname} #{d} #{clk} #{expt} #{zv.length}\r\n#{zv}\r\n", 10)
                                Severity: Minor
                                Found in lib/roma/async_process.rb and 1 other location - About 20 mins to fix
                                lib/roma/async_process.rb on lines 201..201

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 27.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                      t = Thread.new do
                                        begin
                                          acquired_recover_process
                                        rescue => e
                                          @log.error("#{__method__}:#{e.inspect} #{$ERROR_POSITION}")
                                Severity: Minor
                                Found in lib/roma/async_process.rb and 1 other location - About 15 mins to fix
                                lib/roma/async_process.rb on lines 181..187

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 26.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                      t = Thread.new do
                                        begin
                                          balance_process
                                        rescue => e
                                          @log.error("#{__method__}:#{e.inspect} #{$ERROR_POSITION}")
                                Severity: Minor
                                Found in lib/roma/async_process.rb and 1 other location - About 15 mins to fix
                                lib/roma/async_process.rb on lines 274..280

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 26.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                There are no issues that match your filters.

                                Category
                                Status