Showing 491 of 491 total issues

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

      def ev_alist_shift(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, d)
Severity: Major
Found in lib/roma/plugin/plugin_alist.rb and 1 other location - About 4 hrs to fix
lib/roma/plugin/plugin_alist.rb on lines 810..839

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

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 ev_alist_pop(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, d)
Severity: Major
Found in lib/roma/plugin/plugin_alist.rb and 1 other location - About 4 hrs to fix
lib/roma/plugin/plugin_alist.rb on lines 1169..1198

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

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

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

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

          def random_rquest_sender(ini_nodes, n)
            puts __method__
            rc=Roma::Client::RomaClient.new(ini_nodes)
          
            loop do
          Severity: Major
          Found in lib/roma/tools/safecopy_integration_test.rb and 2 other locations - About 3 hrs to fix
          lib/roma/tools/safecopy_test.rb on lines 21..43
          lib/roma/tools/simple_bench.rb on lines 21..43

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

          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 3 locations. Consider refactoring.
          Open

          def random_request_sender(ini_nodes, n)
            puts __method__
            rc=Roma::Client::RomaClient.new(ini_nodes)
          
            loop do
          Severity: Major
          Found in lib/roma/tools/simple_bench.rb and 2 other locations - About 3 hrs to fix
          lib/roma/tools/safecopy_integration_test.rb on lines 23..45
          lib/roma/tools/safecopy_test.rb on lines 21..43

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

          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 3 locations. Consider refactoring.
          Open

          def random_rquest_sender(ini_nodes, n)
            puts __method__
            rc=Roma::Client::RomaClient.new(ini_nodes)
          
            loop do
          Severity: Major
          Found in lib/roma/tools/safecopy_test.rb and 2 other locations - About 3 hrs to fix
          lib/roma/tools/safecopy_integration_test.rb on lines 23..45
          lib/roma/tools/simple_bench.rb on lines 21..43

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

          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

          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
            Severity
            Category
            Status
            Source
            Language