Class Call
has 49 methods (exceeds 20 allowed). Consider refactoring. Open
class Call
Hangup = Class.new Adhearsion::Error
CommandTimeout = Class.new Adhearsion::Error
ExpiredError = Class.new Celluloid::DeadActorError
File call.rb
has 369 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'has_guarded_handlers'
require 'thread'
require 'active_support/hash_with_indifferent_access'
require 'active_support/core_ext/hash/indifferent_access'
require 'adhearsion'
Method register_initial_handlers
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def register_initial_handlers
register_event_handler Adhearsion::Event::Offer do |offer|
@offer = offer
@client = offer.client
@start_time = offer.timestamp.to_time
Method register_initial_handlers
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def register_initial_handlers
register_event_handler Adhearsion::Event::Offer do |offer|
@offer = offer
@client = offer.client
@start_time = offer.timestamp.to_time
- 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 write_and_await_response
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def write_and_await_response(command, timeout = 60, fatal = false)
@commands << command
write_command command
error_handler = fatal ? ->(error) { raise error } : ->(error) { abort error }
- 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 write_command
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def write_command(command)
abort Hangup.new(@end_reason) unless active? || command.is_a?(Adhearsion::Rayo::Command::Hangup)
merge_headers command.headers if command.respond_to? :headers
logger.debug "Executing command #{command.inspect}"
unless command.is_a?(Adhearsion::Rayo::Command::Dial)
- 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"