Showing 491 of 491 total issues

File sys_command_receiver.rb has 1149 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'roma/async_process'

module Roma
  module Command

Severity: Major
Found in lib/roma/command/sys_command_receiver.rb - About 2 days to fix

    File plugin_alist.rb has 1085 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'timeout'
    require 'roma/messaging/con_pool'
    require 'json'
    
    module Roma
    Severity: Major
    Found in lib/roma/plugin/plugin_alist.rb - About 2 days to fix

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

      require 'thread'
      require 'digest/sha1'
      require 'timeout'
      
      module Roma
      Severity: Major
      Found in lib/roma/async_process.rb - About 2 days to fix

        File romad.rb has 692 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'optparse'
        require 'roma/version'
        require 'roma/stats'
        require 'roma/command_plugin'
        require 'roma/async_process'
        Severity: Major
        Found in lib/roma/romad.rb - About 1 day to fix

          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

            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 start has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
              Open

                  def start
                    # config version check
                    if !Config.const_defined?(:VERSION)
                      @log.error("ROMA FAIL TO BOOT! : config.rb's version is too old.")
                      exit
              Severity: Minor
              Found in lib/roma/romad.rb - About 1 day to fix

              Cognitive Complexity

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

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

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

              Further reading

              File mkconfig.rb has 519 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'pathname'
              require 'yaml'
              require 'fileutils'
              
              module Roma
              Severity: Major
              Found in lib/roma/tools/mkconfig.rb - About 1 day to fix

                Method ev_spushv has a Cognitive Complexity of 50 (exceeds 5 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: Minor
                Found in lib/roma/command/vn_command_receiver.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

                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 dispatcher has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def dispatcher
                          @stats = Roma::Stats.instance
                          #@log.debug("Roma::Event::Handler.dipatcher called")
                          while(@connected) do
                            @enter_time = nil
                  Severity: Minor
                  Found in lib/roma/event/handler.rb - About 6 hrs to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  File command_definition.rb has 391 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  module Roma
                    module Command
                      module Definition
                  
                        class ClientErrorException < Exception; end
                  Severity: Minor
                  Found in lib/roma/command/command_definition.rb - About 5 hrs to fix

                    Method def_write_command_with_key has a Cognitive Complexity of 34 (exceeds 5 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: Minor
                    Found in lib/roma/command/command_definition.rb - About 5 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 a Cognitive Complexity of 34 (exceeds 5 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: Minor
                    Found in lib/roma/command/command_definition.rb - About 5 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_send_cmd has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def async_send_cmd(nid, cmd, tout=nil)
                          con = res = nil
                          if tout
                            Timeout.timeout(tout){
                              con = Roma::Messaging::ConPool.instance.get_connection(nid)
                    Severity: Minor
                    Found in lib/roma/romad.rb - About 4 hrs to fix

                    Cognitive Complexity

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

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

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

                    Further reading

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

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

                    Cognitive Complexity

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

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

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

                    Further reading

                    Class ChurnbasedRoutingTable has 35 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                        class ChurnbasedRoutingTable < RoutingTable
                    
                          include Routing::RandomPartitioner
                    
                          attr :fname
                    Severity: Minor
                    Found in lib/roma/routing/cb_rttable.rb - About 4 hrs to fix

                      Method release_process has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                      Open

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

                      Cognitive Complexity

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

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

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

                      Further reading

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

                            def ev_alist_pop(s)
                              hname, k, d, vn, nodes = calc_hash(s[1])
                              return forward1(nodes[0], s) if nodes[0] != @nid
                      
                              ddata = @storages[hname].get(vn, k, d)
                      Severity: Major
                      Found in lib/roma/plugin/plugin_alist.rb and 1 other location - About 4 hrs to fix
                      lib/roma/plugin/plugin_alist.rb on lines 1169..1198

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 145.

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

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

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

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

                      Refactorings

                      Further Reading

                      Severity
                      Category
                      Status
                      Source
                      Language