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"
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"
Class Channel
has 94 methods (exceeds 20 allowed). Consider refactoring. Open
class Channel
#
# API
#
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
File session.rb
has 642 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "socket"
require "thread"
require "monitor"
require "gorgon_bunny/transport"
Class Transport
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class Transport
#
# API
#
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
- Read upRead up
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
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)
Class Queue
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Queue
include GorgonBunny::Compatibility
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
- Read upRead up
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
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?
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
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)
- Read upRead up
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)
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
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