Fitzsimmons/Gorgon

View on GitHub

Showing 60 of 111 total issues

Method encode has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def self.encode(value)
        accumulator = String.new

        case value
        when String then

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

    def run_once
      frame = @transport.read_next_frame
      return if frame.is_a?(GorgonAMQ::Protocol::HeartbeatFrame)

      if !frame.final? || frame.method_class.has_content?
Severity: Minor
Found in lib/gorgon_bunny/lib/gorgon_bunny/reader_loop.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 open_connection has a Cognitive Complexity of 11 (exceeds 5 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

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

    def handle_ack_or_nack(delivery_tag, multiple, nack)
      if nack
        cloned_set = @unconfirmed_set.clone
        if multiple
          cloned_set.keep_if { |i| i <= delivery_tag }
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 basic_consume has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def basic_consume(queue, consumer_tag = generate_consumer_tag, no_ack = false, exclusive = false, arguments = nil, &block)
      raise_if_no_longer_open!
      maybe_start_consumer_work_pool!

      queue_name = if queue.respond_to?(:name)
Severity: Minor
Found in lib/gorgon_bunny/lib/gorgon_bunny/channel.rb - About 1 hr to fix

    Method encode has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def self.encode(channel, exchange, type, passive, durable, auto_delete, internal, nowait, arguments)
    Severity: Major
    Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb - About 1 hr to fix

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

          def basic_publish(payload, exchange, routing_key, opts = {})
            raise_if_no_longer_open!
      
            exchange_name = if exchange.respond_to?(:name)
                              exchange.name
      Severity: Minor
      Found in lib/gorgon_bunny/lib/gorgon_bunny/channel.rb - About 1 hr to fix

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

              def self.create_gorgon_json content
                if File.exist? GORGON_JSON_FILE
                  puts "#{GORGON_JSON_FILE} exists. Skipping..."
                  return
                end
        Severity: Minor
        Found in lib/gorgon/settings/initial_files_creator.rb - About 1 hr to fix

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

                def self.decode_properties(data)
                  offset, data_length, properties = 0, data.bytesize, {}
          
                  compressed_index = data[offset, 2].unpack(PACK_UINT16)[0]
                  offset += 2
          Severity: Minor
          Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb - About 1 hr to fix

            Method decode_properties has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                  def self.decode_properties(data)
                    offset, data_length, properties = 0, data.bytesize, {}
            
                    compressed_index = data[offset, 2].unpack(PACK_UINT16)[0]
                    offset += 2
            Severity: Minor
            Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.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 a Cognitive Complexity of 10 (exceeds 5 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

            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 read_fully has 27 lines of code (exceeds 25 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 1 hr to fix

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

                      def self.encode(channel, payload, user_headers, exchange, routing_key, mandatory, immediate, frame_size)
              Severity: Major
              Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb - About 1 hr to fix

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

                        def self.encode(channel, queue, passive, durable, exclusive, auto_delete, nowait, arguments)
                Severity: Major
                Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb - About 1 hr to fix

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

                          def self.encode(channel, queue, consumer_tag, no_local, no_ack, exclusive, nowait, arguments)
                  Severity: Major
                  Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb - About 1 hr to fix

                    Method subscribe_to_originator_queue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def subscribe_to_originator_queue
                    
                          originator_watcher = proc do
                            payload = nil
                            while true
                    Severity: Minor
                    Found in lib/gorgon/worker_manager.rb - About 55 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 parse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def self.parse(connection_string)
                          uri = ::URI.parse(connection_string)
                          raise ArgumentError.new("Connection URI must use amqp or amqps schema (example: amqp://bus.megacorp.internal:5766), learn more at http://bit.ly/ks8MXK") unless %w{amqp amqps}.include?(uri.scheme)
                    
                          opts = {}
                    Severity: Minor
                    Found in lib/gorgon_amq-protocol/lib/gorgon_amq/uri.rb - About 55 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 read_fully has a Cognitive Complexity of 9 (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/socket.rb - About 55 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 configure has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def self.configure(settings = nil)
                            case settings
                            when Hash then
                              if username = (settings.delete(:username) || settings.delete(:user))
                                settings[:user] ||= username
                    Severity: Minor
                    Found in lib/gorgon_amq-protocol/lib/gorgon_amq/settings.rb - About 55 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 write has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def write(data)
                          begin
                            if @read_write_timeout
                              GorgonBunny::Timeout.timeout(@read_write_timeout, GorgonBunny::ClientTimeout) do
                                if open?
                    Severity: Minor
                    Found in lib/gorgon_bunny/lib/gorgon_bunny/transport.rb - About 55 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

                    Severity
                    Category
                    Status
                    Source
                    Language