nulogy/Gorgon

View on GitHub

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

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

                          class Bind < Protocol::Method
                            @name = "queue.bind"
                            @method_id = 20
                            @index = 0x00320014 # 50, 20, 3276820
                            @packed_indexes = [50, 20].pack(PACK_UINT16_X2).freeze
                    Severity: Major
                    Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb and 2 other locations - About 2 hrs to fix
                    lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb on lines 899..926
                    lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb on lines 953..980

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

                    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 3 locations. Consider refactoring.
                    Open

                          class Bind < Protocol::Method
                            @name = "exchange.bind"
                            @method_id = 30
                            @index = 0x0028001E # 40, 30, 2621470
                            @packed_indexes = [40, 30].pack(PACK_UINT16_X2).freeze
                    Severity: Major
                    Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb and 2 other locations - About 2 hrs to fix
                    lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb on lines 953..980
                    lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb on lines 1081..1108

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

                    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 3 locations. Consider refactoring.
                    Open

                          class Unbind < Protocol::Method
                            @name = "exchange.unbind"
                            @method_id = 40
                            @index = 0x00280028 # 40, 40, 2621480
                            @packed_indexes = [40, 40].pack(PACK_UINT16_X2).freeze
                    Severity: Major
                    Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb and 2 other locations - About 2 hrs to fix
                    lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb on lines 899..926
                    lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb on lines 1081..1108

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

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

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

                            class FlowOk < Protocol::Method
                              @name = "channel.flow-ok"
                              @method_id = 21
                              @index = 0x00140015 # 20, 21, 1310741
                              @packed_indexes = [20, 21].pack(PACK_UINT16_X2).freeze
                      Severity: Major
                      Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb and 2 other locations - About 2 hrs to fix
                      lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb on lines 637..668
                      lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb on lines 2248..2279

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

                      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 3 locations. Consider refactoring.
                      Open

                            class Select < Protocol::Method
                              @name = "confirm.select"
                              @method_id = 10
                              @index = 0x0055000A # 85, 10, 5570570
                              @packed_indexes = [85, 10].pack(PACK_UINT16_X2).freeze
                      Severity: Major
                      Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb and 2 other locations - About 2 hrs to fix
                      lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb on lines 637..668
                      lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb on lines 673..704

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

                      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 3 locations. Consider refactoring.
                      Open

                            class Flow < Protocol::Method
                              @name = "channel.flow"
                              @method_id = 20
                              @index = 0x00140014 # 20, 20, 1310740
                              @packed_indexes = [20, 20].pack(PACK_UINT16_X2).freeze
                      Severity: Major
                      Found in lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb and 2 other locations - About 2 hrs to fix
                      lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb on lines 673..704
                      lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb on lines 2248..2279

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

                      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 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
                          Severity
                          Category
                          Status
                          Source
                          Language