nulogy/Gorgon

View on GitHub
lib/gorgon_bunny/lib/gorgon_bunny/transport.rb

Summary

Maintainability
C
1 day
Test Coverage

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

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

      Method initialize_tls_context has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize_tls_context(ctx)
            ctx.cert       = OpenSSL::X509::Certificate.new(@tls_certificate) if @tls_certificate
            ctx.key        = OpenSSL::PKey::RSA.new(@tls_key) if @tls_key
            ctx.cert_store = if @tls_certificate_store
                               @tls_certificate_store
      Severity: Minor
      Found in lib/gorgon_bunny/lib/gorgon_bunny/transport.rb - About 45 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

      There are no issues that match your filters.

      Category
      Status