nulogy/Gorgon

View on GitHub

Showing 60 of 111 total issues

File client.rb has 1731 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "gorgon_amq/pack"

require "gorgon_amq/protocol/table"
require "gorgon_amq/protocol/frame"

Severity: Major
Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb - About 4 days to fix

    File channel.rb has 831 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "thread"
    require "monitor"
    require "set"
    
    require "gorgon_bunny/concurrent/atomic_fixnum"
    Severity: Major
    Found in lib/gorgon_bunny/lib/gorgon_bunny/channel.rb - About 1 day to fix

      Class Channel has 94 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Channel
      
          #
          # API
          #
      Severity: Major
      Found in lib/gorgon_bunny/lib/gorgon_bunny/channel.rb - About 1 day to fix

        Class Session has 81 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Session
        
            # Default host used for connection
            DEFAULT_HOST      = "127.0.0.1"
            # Default virtual host used for connection
        Severity: Major
        Found in lib/gorgon_bunny/lib/gorgon_bunny/session.rb - About 1 day to fix

          File session.rb has 642 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "socket"
          require "thread"
          require "monitor"
          
          require "gorgon_bunny/transport"
          Severity: Major
          Found in lib/gorgon_bunny/lib/gorgon_bunny/session.rb - About 1 day to fix

            Class Transport has 40 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class Transport
            
                #
                # API
                #
            Severity: Minor
            Found in lib/gorgon_bunny/lib/gorgon_bunny/transport.rb - About 5 hrs to fix

              Method run_loop has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                  def run_loop
                    loop do
                      begin
                        break if @stopping || @network_is_down
                        run_once
              Severity: Minor
              Found in lib/gorgon_bunny/lib/gorgon_bunny/reader_loop.rb - About 3 hrs to fix

              Cognitive Complexity

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

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

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

              Further reading

              File transport.rb has 290 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require "socket"
              require "thread"
              require "monitor"
              
              begin
              Severity: Minor
              Found in lib/gorgon_bunny/lib/gorgon_bunny/transport.rb - About 2 hrs to fix

                Method handle_method has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def handle_method(method)
                      @logger.debug "Channel#handle_frame on channel #{@id}: #{method.inspect}"
                      case method
                      when GorgonAMQ::Protocol::Queue::DeclareOk then
                        @continuations.push(method)
                Severity: Major
                Found in lib/gorgon_bunny/lib/gorgon_bunny/channel.rb - About 2 hrs to fix

                  Class Queue has 23 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class Queue
                  
                      include GorgonBunny::Compatibility
                  
                  
                  
                  Severity: Minor
                  Found in lib/gorgon_bunny/lib/gorgon_bunny/queue.rb - About 2 hrs to fix

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

                          def read_fully(count, timeout = nil)
                            return nil if @__bunny_socket_eof_flag__
                    
                            value = ''
                            begin
                    Severity: Minor
                    Found in lib/gorgon_bunny/lib/gorgon_bunny/ssl_socket.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

                    Class Originator has 21 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                      class Originator
                        include Configuration
                    
                        SPEC_SUCCESS_EXIT_STATUS = 0
                        SPEC_FAILURE_EXIT_STATUS = 1
                    Severity: Minor
                    Found in lib/gorgon/originator.rb - About 2 hrs to fix

                      Method decode has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def self.decode(data)
                              table        = Hash.new
                              table_length = data.unpack(PACK_UINT32).first
                      
                              return table if table_length.zero?
                      Severity: Major
                      Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/table.rb - About 2 hrs to fix

                        Method decode_array has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def self.decode_array(data, initial_offset)
                                array_length = data.slice(initial_offset, 4).unpack(PACK_UINT32).first
                        
                                ary    = Array.new
                                offset = initial_offset + 4

                          Method encode has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                def self.encode(value)
                                  accumulator = String.new
                          
                                  case value
                                  when String then

                            Method open_connection has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def open_connection
                                  @transport.send_frame(GorgonAMQ::Protocol::Connection::StartOk.encode(@client_properties, @mechanism, self.encode_credentials(username, password), @locale))
                                  @logger.debug "Sent connection.start-ok"
                            
                                  frame = begin
                            Severity: Minor
                            Found in lib/gorgon_bunny/lib/gorgon_bunny/session.rb - About 1 hr to fix

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

                                  def handle_method(method)
                                    @logger.debug "Channel#handle_frame on channel #{@id}: #{method.inspect}"
                                    case method
                                    when GorgonAMQ::Protocol::Queue::DeclareOk then
                                      @continuations.push(method)
                              Severity: Minor
                              Found in lib/gorgon_bunny/lib/gorgon_bunny/channel.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 handle_frame has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def handle_frame(ch_number, method)
                                    @logger.debug "Session#handle_frame on #{ch_number}: #{method.inspect}"
                                    case method
                                    when GorgonAMQ::Protocol::Channel::OpenOk then
                                      @continuations.push(method)
                              Severity: Minor
                              Found in lib/gorgon_bunny/lib/gorgon_bunny/session.rb - About 1 hr to fix

                                Method initialize has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def initialize(connection_string_or_opts = Hash.new, optz = Hash.new)
                                      opts = case (ENV["RABBITMQ_URL"] || connection_string_or_opts)
                                             when nil then
                                               Hash.new
                                             when String then
                                Severity: Minor
                                Found in lib/gorgon_bunny/lib/gorgon_bunny/session.rb - About 1 hr to fix

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

                                      def fork_a_worker
                                        @available_worker_slots -= 1
                                        ENV["GORGON_CONFIG_PATH"] = @listener_config_filename
                                  
                                        worker_id = get_worker_id
                                  Severity: Minor
                                  Found in lib/gorgon/worker_manager.rb - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language