lib/roma/plugin/plugin_storage.rb

Summary

Maintainability
F
1 wk
Test Coverage

File plugin_storage.rb has 623 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'zlib'
require 'digest/sha1'
require 'roma/async_process'

module Roma
Severity: Major
Found in lib/roma/plugin/plugin_storage.rb - About 1 day 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 ev_fdelete has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

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

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

          def ev_gets(s)
            nk = {} # {node-id1=>[key1,key2,..],node-id2=>[key3,key4,..]}
            kvn = {} # {key1=>vn1, key2=>vn2, ... }
            s[1..-1].each{|kh|
              key, = kh.split("\e") # split a hash-name
    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 ev_delete has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

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

            def ev_get_expt(s)
              unless s.length.between?(2, 3)
                @log.error("get_expt: wrong number of arguments(#{s.length-1} to 2-3)")
                return send_data("CLIENT_ERROR Wrong number of arguments.\r\n")
              end
      Severity: Minor
      Found in lib/roma/plugin/plugin_storage.rb - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

            def ev_set_expt(s)
              key,hname = s[1].split("\e")
              hname ||= @defhash
              d = Digest::SHA1.hexdigest(key).hex % @rttable.hbits
              vn = @rttable.get_vnode_id(d)
      Severity: Minor
      Found in lib/roma/plugin/plugin_storage.rb - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method store has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

            def store(fnc, hname, vn, k, d, expt, v, nodes)
              expt = chg_time_expt(expt)
              unless @storages.key?(hname)
                send_data("SERVER_ERROR #{hname} does not exists.\r\n")
                return
      Severity: Minor
      Found in lib/roma/plugin/plugin_storage.rb - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method store_incr_decr has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

            def store_incr_decr(fnc, hname, vn, k, d, v, nodes)
              unless @storages.key?(hname)
                send_data("SERVER_ERROR #{hname} does not exists.\r\n")
                return
              end
      Severity: Minor
      Found in lib/roma/plugin/plugin_storage.rb - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method ev_get_expt has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def ev_get_expt(s)
              unless s.length.between?(2, 3)
                @log.error("get_expt: wrong number of arguments(#{s.length-1} to 2-3)")
                return send_data("CLIENT_ERROR Wrong number of arguments.\r\n")
              end
      Severity: Minor
      Found in lib/roma/plugin/plugin_storage.rb - About 1 hr to fix

        Method store_cas has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

              def store_cas(hname, vn, k, d, clk, expt, v, nodes)
                expt = chg_time_expt(expt)
                unless @storages.key?(hname)
                  send_data("SERVER_ERROR #{hname} does not exists.\r\n")
                  return
        Severity: Minor
        Found in lib/roma/plugin/plugin_storage.rb - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method ev_fset_expt has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

              def ev_fset_expt(s)
                key,hname = s[1].split("\e")
                hname ||= @defhash
                d = Digest::SHA1.hexdigest(key).hex % @rttable.hbits
                vn = @rttable.get_vnode_id(d)
        Severity: Minor
        Found in lib/roma/plugin/plugin_storage.rb - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method ev_fdelete has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def ev_fdelete(s)
                key,hname = s[1].split("\e")
                hname ||= @defhash
                d = Digest::SHA1.hexdigest(key).hex % @rttable.hbits
                vn = @rttable.get_vnode_id(d)
        Severity: Minor
        Found in lib/roma/plugin/plugin_storage.rb - About 1 hr to fix

          Method ev_set_expt has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def ev_set_expt(s)
                  key,hname = s[1].split("\e")
                  hname ||= @defhash
                  d = Digest::SHA1.hexdigest(key).hex % @rttable.hbits
                  vn = @rttable.get_vnode_id(d)
          Severity: Minor
          Found in lib/roma/plugin/plugin_storage.rb - About 1 hr to fix

            Method ev_gets has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def ev_gets(s)
                    nk = {} # {node-id1=>[key1,key2,..],node-id2=>[key3,key4,..]}
                    kvn = {} # {key1=>vn1, key2=>vn2, ... }
                    s[1..-1].each{|kh|
                      key, = kh.split("\e") # split a hash-name
            Severity: Minor
            Found in lib/roma/plugin/plugin_storage.rb - About 1 hr to fix

              Method ev_fset_expt has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def ev_fset_expt(s)
                      key,hname = s[1].split("\e")
                      hname ||= @defhash
                      d = Digest::SHA1.hexdigest(key).hex % @rttable.hbits
                      vn = @rttable.get_vnode_id(d)
              Severity: Minor
              Found in lib/roma/plugin/plugin_storage.rb - About 1 hr to fix

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

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

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method store_cas has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def store_cas(hname, vn, k, d, clk, expt, v, nodes)
                        expt = chg_time_expt(expt)
                        unless @storages.key?(hname)
                          send_data("SERVER_ERROR #{hname} does not exists.\r\n")
                          return
                Severity: Minor
                Found in lib/roma/plugin/plugin_storage.rb - About 1 hr to fix

                  Method ev_get has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Method store_cas has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                          def store_cas(hname, vn, k, d, clk, expt, v, nodes)
                    Severity: Major
                    Found in lib/roma/plugin/plugin_storage.rb - About 1 hr to fix

                      Method store has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                            def store(fnc, hname, vn, k, d, expt, v, nodes)
                      Severity: Major
                      Found in lib/roma/plugin/plugin_storage.rb - About 1 hr to fix

                        Method redundant has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                              def redundant(nodes, hname, k, d, clk, expt, v)
                        Severity: Major
                        Found in lib/roma/plugin/plugin_storage.rb - About 50 mins to fix

                          Method zredundant has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                def zredundant(nodes, hname, k, d, clk, expt, v)
                          Severity: Major
                          Found in lib/roma/plugin/plugin_storage.rb - About 50 mins to fix

                            Method store_incr_decr has 7 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                  def store_incr_decr(fnc, hname, vn, k, d, v, nodes)
                            Severity: Major
                            Found in lib/roma/plugin/plugin_storage.rb - About 50 mins to fix

                              Method forward_get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def forward_get(nid, k, d)
                                      con = get_connection(nid)
                                      con.send("fget #{k}\r\n")
                                      res = con.gets
                                      if res == nil
                              Severity: Minor
                              Found in lib/roma/plugin/plugin_storage.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 set has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def set(fnc,s)
                                      if s.length != 5
                                        @log.error("set: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 35 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

                              Avoid too many return statements within this method.
                              Open

                                      return send_data("NOT_FOUND\r\n") if res == :deletemark
                              Severity: Major
                              Found in lib/roma/plugin/plugin_storage.rb - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                        return send_data("NOT_FOUND\r\n") unless res[4]
                                Severity: Major
                                Found in lib/roma/plugin/plugin_storage.rb - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                          return send_data("NOT_DELETED\r\n") unless res
                                  Severity: Major
                                  Found in lib/roma/plugin/plugin_storage.rb - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                            return send_data("NOT_FOUND\r\n") unless res[4]
                                    Severity: Major
                                    Found in lib/roma/plugin/plugin_storage.rb - About 30 mins to fix

                                      Method ev_fget has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                      Open

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

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

                                              nodes.each{ |nid|
                                                res = send_cmd(nid,"rset #{k}\e#{hname} #{d} #{clk} #{expt} #{v.length}\r\n#{v}\r\n")
                                                if res == nil || res.start_with?("ERROR")
                                                  Roma::AsyncProcess::queue.push(Roma::AsyncMessage.new('redundant',[nid,hname,k,d,clk,expt,v]))
                                                  @log.warn("redundant failed:#{k}\e#{hname} #{d} #{clk} #{expt} #{v.length} -> #{nid}")
                                      Severity: Major
                                      Found in lib/roma/plugin/plugin_storage.rb and 1 other location - About 2 hrs to fix
                                      lib/roma/plugin/plugin_storage.rb on lines 630..635

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

                                      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

                                              nodes.each{ |nid|
                                                res = send_cmd(nid,"rzset #{k}\e#{hname} #{d} #{clk} #{expt} #{zv.length}\r\n#{zv}\r\n")
                                                if res == nil || res.start_with?("ERROR")
                                                  Roma::AsyncProcess::queue.push(Roma::AsyncMessage.new('zredundant',[nid,hname,k,d,clk,expt,zv]))
                                                  @log.warn("zredundant failed:#{k}\e#{hname} #{d} #{clk} #{expt} #{zv.length} -> #{nid}")
                                      Severity: Major
                                      Found in lib/roma/plugin/plugin_storage.rb and 1 other location - About 2 hrs to fix
                                      lib/roma/plugin/plugin_storage.rb on lines 618..623

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

                                      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

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

                                                res2 = send_cmd(nid,"rdelete #{key}\e#{hname} #{res[2]}\r\n")
                                                unless res2
                                                  Roma::AsyncProcess::queue.push(Roma::AsyncMessage.new('rdelete',[nid,hname,s[1],res[2]]))
                                                  @log.warn("rdelete failed:#{s[1]}\e#{hname} #{d} #{res[2]} -> #{nid}")
                                      Severity: Major
                                      Found in lib/roma/plugin/plugin_storage.rb and 1 other location - About 1 hr to fix
                                      lib/roma/plugin/plugin_storage.rb on lines 212..215

                                      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

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

                                                res2 = send_cmd(nid,"rdelete #{key}\e#{hname} #{res[2]}\r\n")
                                                unless res2
                                                  Roma::AsyncProcess::queue.push(Roma::AsyncMessage.new('rdelete',[nid,hname,s[1],res[2]]))
                                                  @log.warn("rdelete failed:#{s[1]}\e#{hname} #{d} #{res[2]} -> #{nid}")
                                      Severity: Major
                                      Found in lib/roma/plugin/plugin_storage.rb and 1 other location - About 1 hr to fix
                                      lib/roma/plugin/plugin_storage.rb on lines 163..166

                                      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

                                            def ev_set_size_of_zredundant(s)
                                              if s.length != 2 || s[1].to_i == 0
                                                return send_data("usage:set_set_size_of_zredundant <n>\r\n")
                                              end
                                              res = broadcast_cmd("rset_size_of_zredundant #{s[1]}\r\n")
                                      Severity: Minor
                                      Found in lib/roma/plugin/plugin_storage.rb and 1 other location - About 45 mins to fix
                                      lib/roma/command/rt_command_receiver.rb on lines 198..205

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

                                      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

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

                                              if @stats.wb_command_map.key?("#{fnc.to_s}__prev".to_sym)
                                                data = @storages[hname].get(vn, k, d)
                                                Roma::WriteBehindProcess::push(hname, @stats.wb_command_map["#{fnc.to_s}__prev".to_sym], k, data) if data
                                      Severity: Minor
                                      Found in lib/roma/plugin/plugin_storage.rb and 1 other location - About 35 mins to fix
                                      lib/roma/plugin/plugin_storage.rb on lines 694..696

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

                                      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

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

                                              if @stats.wb_command_map.key?("#{fnc.to_s}__prev".to_sym)
                                                data = @storages[hname].get(vn, k, d)
                                                Roma::WriteBehindProcess::push(hname, @stats.wb_command_map["#{fnc.to_s}__prev".to_sym], k, data) if data
                                      Severity: Minor
                                      Found in lib/roma/plugin/plugin_storage.rb and 1 other location - About 35 mins to fix
                                      lib/roma/plugin/plugin_storage.rb on lines 552..554

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

                                      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

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

                                                if $roma.cr_writer.run_replication
                                                  fnc = 'set_expt'
                                                  Roma::WriteBehindProcess::push(nil, "#{fnc} #{s[1]} #{expt}\r\n", s[1], expt)
                                      Severity: Minor
                                      Found in lib/roma/plugin/plugin_storage.rb and 1 other location - About 20 mins to fix
                                      lib/roma/plugin/plugin_storage.rb on lines 356..358

                                      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

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

                                                if $roma.cr_writer.run_replication
                                                  fnc = 'set_expt'
                                                  Roma::WriteBehindProcess::push(nil, "#{fnc} #{s[1]} #{expt}\r\n", s[1], expt)
                                      Severity: Minor
                                      Found in lib/roma/plugin/plugin_storage.rb and 1 other location - About 20 mins to fix
                                      lib/roma/plugin/plugin_storage.rb on lines 397..399

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

                                              if @stats.wb_command_map.key?(:delete__prev)
                                                data = @storages[hname].get(vn, key, d)
                                                Roma::WriteBehindProcess::push(hname, @stats.wb_command_map[:delete__prev], key, data) if data
                                      Severity: Minor
                                      Found in lib/roma/plugin/plugin_storage.rb and 2 other locations - About 15 mins to fix
                                      lib/roma/plugin/plugin_storage.rb on lines 195..197
                                      lib/roma/plugin/plugin_storage.rb on lines 583..585

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

                                              if @stats.wb_command_map.key?(:delete__prev)
                                                data = @storages[hname].get(vn, key, d)
                                                Roma::WriteBehindProcess::push(hname, @stats.wb_command_map[:delete__prev], key, data) if data
                                      Severity: Minor
                                      Found in lib/roma/plugin/plugin_storage.rb and 2 other locations - About 15 mins to fix
                                      lib/roma/plugin/plugin_storage.rb on lines 147..149
                                      lib/roma/plugin/plugin_storage.rb on lines 583..585

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

                                              if @stats.wb_command_map.key?(:cas__prev)
                                                data = @storages[hname].get(vn, k, d)
                                                Roma::WriteBehindProcess::push(hname, @stats.wb_command_map[:cas__prev], k, data) if data
                                      Severity: Minor
                                      Found in lib/roma/plugin/plugin_storage.rb and 2 other locations - About 15 mins to fix
                                      lib/roma/plugin/plugin_storage.rb on lines 147..149
                                      lib/roma/plugin/plugin_storage.rb on lines 195..197

                                      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

                                            def ev_rset_size_of_zredundant(s)
                                              if s.length != 2 || s[1].to_i == 0
                                                return send_data("usage:set_set_size_of_zredundant <n>\r\n")
                                              end
                                              @stats.size_of_zredundant = s[1].to_i
                                      Severity: Minor
                                      Found in lib/roma/plugin/plugin_storage.rb and 1 other location - About 15 mins to fix
                                      lib/roma/command/rt_command_receiver.rb on lines 209..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 25.

                                      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