lib/roma/storage/basic_storage.rb

Summary

Maintainability
F
1 wk
Test Coverage

File basic_storage.rb has 615 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'digest/sha1'
require 'thread'
require 'fileutils'

module Roma
Severity: Major
Found in lib/roma/storage/basic_storage.rb - About 1 day to fix

    Method each_clean_up has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

          def each_clean_up(t, vnhash)
            @do_clean_up = true
    
            f = nil;
            if @cleanup_regexp && File.exist?(@storage_path)
    Severity: Minor
    Found in lib/roma/storage/basic_storage.rb - About 7 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 BasicStorage has 52 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class BasicStorage
    
          attr_reader :hdb
          attr_reader :hdiv
          attr_reader :ext_name
    Severity: Major
    Found in lib/roma/storage/basic_storage.rb - About 7 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 set_db_stat has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

              def each_clean_up(t, vnhash)
                @do_clean_up = true
        
                f = nil;
                if @cleanup_regexp && File.exist?(@storage_path)
        Severity: Minor
        Found in lib/roma/storage/basic_storage.rb - About 1 hr to fix

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

                def load(dmp)
                  n = 0
                  h = Marshal.load(dmp)
                  h.each_pair{ |k, v|
                    # remort data
          Severity: Minor
          Found in lib/roma/storage/basic_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 load_stream_dump has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def load_stream_dump(vn, last, clk, expt, k, v)
          Severity: Minor
          Found in lib/roma/storage/basic_storage.rb - About 45 mins to fix

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

                  def delete(vn, k, d)
                    buf = db_get(vn, k)
                    v = ret = nil
                    clk = 0
                    if buf
            Severity: Minor
            Found in lib/roma/storage/basic_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 each_unpacked_db has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def each_unpacked_db(target_vn, db)
                    count = 0
                    tn =  Time.now.to_i
                    db[@hdiv[target_vn]].each do |k,v|
                      vn, last, clk, expt, val = unpack_data(v)
            Severity: Minor
            Found in lib/roma/storage/basic_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 vn_dump_pack has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def vn_dump_pack(vn, last, clk, expt, k, val)
            Severity: Minor
            Found in lib/roma/storage/basic_storage.rb - About 45 mins to fix

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

                    def each_hdb_dump(i,except_vnh = nil)
                      count = 0
                      @hdb[i].each{|k,v|
                        vn, last, clk, expt, val = unpack_data(v)
                        if except_vnh && except_vnh.key?(vn) || Time.now.to_i > expt
              Severity: Minor
              Found in lib/roma/storage/basic_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 load_stream_dump_for_cachecleaning has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                    def load_stream_dump_for_cachecleaning(vn, last, clk, expt, k, v)
              Severity: Minor
              Found in lib/roma/storage/basic_storage.rb - About 45 mins to fix

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

                      def load_stream_dump_for_cachecleaning(vn, last, clk, expt, k, v)
                        n = @hdiv[vn]
                        buf = @hdb[n].get(k)
                        if buf
                          data = unpack_header(buf)
                Severity: Minor
                Found in lib/roma/storage/basic_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 load_stream_dump has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                      def load_stream_dump(vn, last, clk, expt, k, v)
                        buf = db_get(vn, k)
                        if buf
                          data = unpack_header(buf)
                          if last - data[1] < @logic_clock_expire && cmp_clk(clk,data[2]) <= 0
                Severity: Minor
                Found in lib/roma/storage/basic_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 cas has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                      def cas(vn, k, d, clk, expt, v)
                Severity: Minor
                Found in lib/roma/storage/basic_storage.rb - About 45 mins to fix

                  Method rset has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        def rset(vn, k, d, clk, expt, v)
                  Severity: Minor
                  Found in lib/roma/storage/basic_storage.rb - About 45 mins to fix

                    Method add has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                          def add(vn, k, d, expt, v)
                    Severity: Minor
                    Found in lib/roma/storage/basic_storage.rb - About 35 mins to fix

                      Method append has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                            def append(vn, k, d, expt, v)
                      Severity: Minor
                      Found in lib/roma/storage/basic_storage.rb - About 35 mins to fix

                        Method pack_data has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                              def pack_data(vn, physical_clock, logical_clock, expire,value)
                        Severity: Minor
                        Found in lib/roma/storage/basic_storage.rb - About 35 mins to fix

                          Method set has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                def set(vn, k, d, expt, v)
                          Severity: Minor
                          Found in lib/roma/storage/basic_storage.rb - About 35 mins to fix

                            Method prepend has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                  def prepend(vn, k, d, expt, v)
                            Severity: Minor
                            Found in lib/roma/storage/basic_storage.rb - About 35 mins to fix

                              Method replace has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                    def replace(vn, k, d, expt, v)
                              Severity: Minor
                              Found in lib/roma/storage/basic_storage.rb - About 35 mins to fix

                                Method db_get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                      def db_get(vn, k)
                                        n = @hdiv[vn]
                                        d = @hdb[n].get(k)
                                        return d if @dbs[n] == :normal
                                
                                
                                Severity: Minor
                                Found in lib/roma/storage/basic_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

                                Method each_vn_dump has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                      def each_vn_dump(target_vn)
                                        n = @hdiv[target_vn]
                                        @stat_lock.synchronize do
                                          return false if @dbs[n] != :normal
                                          return false if @each_vn_dump_vnodes.include?(target_vn)
                                Severity: Minor
                                Found in lib/roma/storage/basic_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

                                Method get_keys_in_cache has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                      def get_keys_in_cache(dn, kn=100)
                                        return nil if @do_each_vn_dump
                                        ret = []
                                        return ret unless @hdbc[dn]
                                        count = 0
                                Severity: Minor
                                Found in lib/roma/storage/basic_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

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

                                      def rdelete(vn, k, d, clk)
                                        buf = db_get(vn, k)
                                        t = Time.now.to_i
                                        if buf
                                          data = unpack_header(buf)
                                Severity: Minor
                                Found in lib/roma/storage/basic_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

                                      def incr(vn, k, d, v)
                                        buf = db_get(vn, k)
                                        return nil unless buf
                                
                                        # buf != nil
                                Severity: Major
                                Found in lib/roma/storage/basic_storage.rb and 1 other location - About 1 hr to fix
                                lib/roma/storage/basic_storage.rb on lines 374..389

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

                                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 decr(vn, k, d, v)
                                        buf = db_get(vn, k)
                                        return nil unless buf
                                
                                        # buf != nil
                                Severity: Major
                                Found in lib/roma/storage/basic_storage.rb and 1 other location - About 1 hr to fix
                                lib/roma/storage/basic_storage.rb on lines 356..371

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

                                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 prepend(vn, k, d, expt, v)
                                        buf = db_get(vn, k)
                                        return nil unless buf
                                
                                        # buf != nil
                                Severity: Major
                                Found in lib/roma/storage/basic_storage.rb and 1 other location - About 1 hr to fix
                                lib/roma/storage/basic_storage.rb on lines 254..265

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

                                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 append(vn, k, d, expt, v)
                                        buf = db_get(vn, k)
                                        return nil unless buf
                                
                                        # buf != nil
                                Severity: Major
                                Found in lib/roma/storage/basic_storage.rb and 1 other location - About 1 hr to fix
                                lib/roma/storage/basic_storage.rb on lines 268..279

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

                                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 except_vnh && except_vnh.key?(vn) || Time.now.to_i > expt
                                            count += 1
                                            sleep @each_vn_dump_sleep if count % @each_vn_dump_sleep_count == 0
                                          else
                                            yield [vn, last, clk, expt, k.length, k, val.length, val].pack("NNNNNa#{k.length}Na#{val.length}")
                                Severity: Major
                                Found in lib/roma/storage/basic_storage.rb and 1 other location - About 1 hr to fix
                                lib/roma/storage/rh_storage.rb on lines 72..78

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

                                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

                                        if logs.length == 0
                                          @log_name="#{@storage_path}/status.log.1"
                                        else
                                          if File::stat("#{@fname}.#{logs.last[0]}").size == 0
                                            @log_name="#{@fname}.#{logs.last[0]}"
                                Severity: Minor
                                Found in lib/roma/storage/basic_storage.rb and 1 other location - About 1 hr to fix
                                lib/roma/routing/cb_rttable.rb on lines 90..96

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

                                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

                                        if buf
                                          data = unpack_header(buf)
                                          if t - data[1] < @logic_clock_expire && cmp_clk(clk,data[2]) <= 0
                                            @error_message = "error:#{t-data[1]} < #{@logic_clock_expire} && cmp_clk(#{clk},#{data[2]})<=0"
                                            return nil
                                Severity: Minor
                                Found in lib/roma/storage/basic_storage.rb and 1 other location - About 55 mins to fix
                                lib/roma/storage/basic_storage.rb on lines 198..203

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

                                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

                                        if buf
                                          data = unpack_data(buf)
                                          if t - data[1] < @logic_clock_expire && cmp_clk(clk,data[2]) <= 0
                                            @error_message = "error:#{t-data[1]} < #{@logic_clock_expire} && cmp_clk(#{clk},#{data[2]})<=0"
                                            return nil
                                Severity: Minor
                                Found in lib/roma/storage/basic_storage.rb and 1 other location - About 55 mins to fix
                                lib/roma/storage/basic_storage.rb on lines 309..314

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

                                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 vn != target_vn || (expt != 0 && tn > expt)
                                            count += 1
                                            sleep @each_vn_dump_sleep if count % @each_vn_dump_sleep_count == 0
                                            next
                                          end
                                Severity: Minor
                                Found in lib/roma/storage/basic_storage.rb and 1 other location - About 15 mins to fix
                                lib/roma/storage/rh_storage.rb on lines 55..59

                                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