Showing 491 of 491 total issues

Method ev_delete has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

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

Cognitive Complexity

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

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

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

Further reading

Method async_process_loop has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def async_process_loop
      loop do
        while msg = @@async_queue.pop
          if send("asyncev_#{msg.event}", msg.args)
            msg.callback.call(msg, true) if msg.callback
Severity: Minor
Found in lib/roma/async_process.rb - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method async_process_loop_for_latency has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def async_process_loop_for_latency
      loop do
        while msg = @@async_queue_latency.pop
          if send("asyncev_#{msg.event}", msg.args)
            msg.callback.call(msg, true) if msg.callback
Severity: Minor
Found in lib/roma/async_process.rb - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method leave has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

      def leave(nid)
        unless @enabled_failover
          return
        end
        return unless @rd.nodes.include?(nid)
Severity: Minor
Found in lib/roma/routing/cb_rttable.rb - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

              if ret.instance_of? Array
                flg, expt, value, count, msg = ret
                ret = @storages[ctx.params.hash_name].set(ctx.params.vn, 
                                                          ctx.params.key,
                                                          ctx.params.digest,
Severity: Major
Found in lib/roma/command/command_definition.rb and 1 other location - About 2 hrs to fix
lib/roma/command/command_definition.rb on lines 130..154

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

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

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

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

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

Refactorings

Further Reading

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

      def ev_alist_last(s)
        hname, k, d, vn, nodes = calc_hash(s[1])
        return forward1(nodes[0], s) if nodes[0] != @nid

        ddata = @storages[hname].get(vn, k, d)
Severity: Major
Found in lib/roma/plugin/plugin_alist.rb and 1 other location - About 2 hrs to fix
lib/roma/plugin/plugin_alist.rb on lines 171..190

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

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 ret.instance_of? Array
                flg, expt, value, count, msg = ret
                ret = @storages[ctx.params.hash_name].set(ctx.params.vn, 
                                                          ctx.params.key,
                                                          ctx.params.digest,
Severity: Major
Found in lib/roma/command/command_definition.rb and 1 other location - About 2 hrs to fix
lib/roma/command/command_definition.rb on lines 243..267

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

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

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

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

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

Refactorings

Further Reading

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

      def ev_alist_first(s)
        hname, k, d, vn, nodes = calc_hash(s[1])
        return forward1(nodes[0], s) if nodes[0] != @nid

        ddata = @storages[hname].get(vn, k, d)
Severity: Major
Found in lib/roma/plugin/plugin_alist.rb and 1 other location - About 2 hrs to fix
lib/roma/plugin/plugin_alist.rb on lines 763..782

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

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

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

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

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

Refactorings

Further Reading

Method ev_alist_to_json has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def ev_alist_to_json(s)
        hname, k, d, vn, nodes = calc_hash(s[1])
        return forward1(nodes[0], s) if nodes[0] != @nid

        ddata = @storages[hname].get(vn, k, 0)
Severity: Minor
Found in lib/roma/plugin/plugin_alist.rb - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method ev_alist_join_with_time has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def ev_alist_join_with_time(s)
        hname, k, d, vn, nodes = calc_hash(s[1])
        data = read_bytes(s[2].to_i)
        read_bytes(2)
        return forward1(nodes[0], s, data) if nodes[0] != @nid
Severity: Minor
Found in lib/roma/plugin/plugin_alist.rb - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method ev_alist_gets_with_time has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def ev_alist_gets_with_time(s)
        hname, k, d, vn, nodes = calc_hash(s[1])
        return forward1(nodes[0], s) if nodes[0] != @nid

        ddata = @storages[hname].get(vn, k, 0)
Severity: Minor
Found in lib/roma/plugin/plugin_alist.rb - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method ev_alist_gets has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def ev_alist_gets(s)
        hname, k, d, vn, nodes = calc_hash(s[1])
        return forward1(nodes[0], s) if nodes[0] != @nid

        ddata = @storages[hname].get(vn, k, 0)
Severity: Minor
Found in lib/roma/plugin/plugin_alist.rb - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method ev_alist_join has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def ev_alist_join(s)
        hname, k, d, vn, nodes = calc_hash(s[1])
        data = read_bytes(s[2].to_i)
        read_bytes(2)
        return forward1(nodes[0], s, data) if nodes[0] != @nid
Severity: Minor
Found in lib/roma/plugin/plugin_alist.rb - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method storage_cachecleaning_process has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def storage_cachecleaning_process(hname, dn)
      count = 0
      rcount = 0
      st = @storages[hname]

Severity: Minor
Found in lib/roma/async_process.rb - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method def_write_command_with_key_value has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def def_write_command_with_key_value(cmd, idx_of_val_len, forward = :one_line, &block)
          define_method "ev_#{cmd}" do |s|
            return send_data("CLIENT_ERROR does not find key\r\n") if s.length < 2
            begin
              params = CommandParams.new
Severity: Major
Found in lib/roma/command/command_definition.rb - About 2 hrs to fix

    Class Handler has 24 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Handler < EventMachine::Connection
          @@ev_list={}
          def self.ev_list; @@ev_list; end
          @@system_commands={}
          def self.system_commands; @@system_commands; end
    Severity: Minor
    Found in lib/roma/event/handler.rb - About 2 hrs to fix

      File write_behind.rb has 275 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'thread'
      require 'roma/stats'
      require 'socket'
      require 'roma/messaging/con_pool'
      require 'timeout'
      Severity: Minor
      Found in lib/roma/write_behind.rb - About 2 hrs to fix

        Method def_write_command_with_key has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def def_write_command_with_key(cmd, forward = :one_line, &block)
                  define_method "ev_#{cmd}" do |s|
                    return send_data("CLIENT_ERROR does not find key\r\n") if s.length < 2
                    begin
                      params = CommandParams.new
        Severity: Major
        Found in lib/roma/command/command_definition.rb - About 2 hrs to fix

          Method upload_data2 has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              def upload_data2(hname, nid, keys)
                con = Roma::Messaging::ConPool.instance.get_connection(nid)
          
                cmd = "#{@pushv_cmd} #{hname} 0\r\n"
                con.write(cmd)
          Severity: Minor
          Found in lib/roma/tools/recoverlost_lib.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_spushv has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def ev_spushv(s)
                  if s.length != 3
                    @log.error("#{__method__}:wrong number of arguments(#{s})")
                    return send_data("CLIENT_ERROR Wrong number of arguments.\r\n")
                  end
          Severity: Major
          Found in lib/roma/command/vn_command_receiver.rb - About 2 hrs to fix
            Severity
            Category
            Status
            Source
            Language