nulogy/Gorgon

View on GitHub

Showing 111 of 111 total issues

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

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

                  def exchange_bind(source, destination, opts = {})
                    raise_if_no_longer_open!
              
                    source_name = if source.respond_to?(:name)
                                    source.name
              Severity: Major
              Found in lib/gorgon_bunny/lib/gorgon_bunny/channel.rb and 1 other location - About 1 hr to fix
              lib/gorgon_bunny/lib/gorgon_bunny/channel.rb on lines 1210..1236

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

              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 exchange_unbind(source, destination, opts = {})
                    raise_if_no_longer_open!
              
                    source_name = if source.respond_to?(:name)
                                    source.name
              Severity: Major
              Found in lib/gorgon_bunny/lib/gorgon_bunny/channel.rb and 1 other location - About 1 hr to fix
              lib/gorgon_bunny/lib/gorgon_bunny/channel.rb on lines 1166..1192

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

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

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

                          class Recover < Protocol::Method
                            @name = "basic.recover"
                            @method_id = 110
                            @index = 0x003C006E # 60, 110, 3932270
                            @packed_indexes = [60, 110].pack(PACK_UINT16_X2).freeze
                    Severity: Minor
                    Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb and 1 other location - About 55 mins to fix
                    lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb on lines 1995..2013

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

                    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

                          class DeleteOk < Protocol::Method
                            @name = "queue.delete-ok"
                            @method_id = 41
                            @index = 0x00320029 # 50, 41, 3276841
                            @packed_indexes = [50, 41].pack(PACK_UINT16_X2).freeze
                    Severity: Minor
                    Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb and 1 other location - About 55 mins to fix
                    lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb on lines 1162..1182

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

                    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

                          class RecoverAsync < Protocol::Method
                            @name = "basic.recover-async"
                            @method_id = 100
                            @index = 0x003C0064 # 60, 100, 3932260
                            @packed_indexes = [60, 100].pack(PACK_UINT16_X2).freeze
                    Severity: Minor
                    Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb and 1 other location - About 55 mins to fix
                    lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb on lines 2018..2036

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

                    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

                          class PurgeOk < Protocol::Method
                            @name = "queue.purge-ok"
                            @method_id = 31
                            @index = 0x0032001F # 50, 31, 3276831
                            @packed_indexes = [50, 31].pack(PACK_UINT16_X2).freeze
                    Severity: Minor
                    Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb and 1 other location - About 55 mins to fix
                    lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb on lines 1217..1237

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

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

                    Severity
                    Category
                    Status
                    Source
                    Language