Showing 73 of 81 total issues
Method unimrcp_app_options
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
def unimrcp_app_options
{uer: 1, b: (@component_node.barge_in == false ? 0 : 1)}.tap do |opts|
opts[:nit] = @initial_timeout if @initial_timeout > -1
opts[:dit] = @inter_digit_timeout if @inter_digit_timeout > -1
opts[:dttc] = input_node.terminator if input_node.terminator
- 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 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
Method process_ami_event
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def process_ami_event(ami_event)
if Asterisk.event_passes_filter?(ami_event)
send_pb_event Adhearsion::Event::Asterisk::AMI.new(name: ami_event.name, headers: ami_event.headers)
end
- 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 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'
File call.rb
has 367 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'has_guarded_handlers'
require 'adhearsion/translator/asterisk/ami_error_converter'
module Adhearsion
module Translator
Method execute_command
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def execute_command(command)
if @block_commands
command.response = Adhearsion::ProtocolError.new.setup :item_not_found, "Could not find a call with ID #{id}", id
return
end
- 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 execute
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def execute
raise OptionError, 'An SSML document is required.' unless @component_node.render_documents.first.value
raise OptionError, 'An interrupt-on value of speech is unsupported.' if @component_node.interrupt_on == :voice
[:start_offset, :start_paused, :repeat_interval, :max_time].each do |opt|
- 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 CallController
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class CallController
include Dial
include Input
include Output
include Record
Method prep_calls
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def prep_calls
@calls = Set.new
@targets.map do |target, specific_options|
new_call = OutboundCall.new
- 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 Call
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Call
include HasGuardedHandlers
InvalidCommandError = Class.new Error
File dial.rb
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'countdownlatch'
module Adhearsion
class CallController
module Dial
Method execute_command
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute_command(command)
if @block_commands
command.response = Adhearsion::ProtocolError.new.setup :item_not_found, "Could not find a call with ID #{id}", id
return
end
Method process_ami_event
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_ami_event(ami_event)
if Asterisk.event_passes_filter?(ami_event)
send_pb_event Adhearsion::Event::Asterisk::AMI.new(name: ami_event.name, headers: ami_event.headers)
end
Method initialize
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(env = :development, &block)
@active_environment = env
Loquacious.env_config = true
Loquacious.env_prefix = "AHN"
Class Asterisk
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Asterisk
include Celluloid
# Indicates that a command was executed against a channel which no longer exists
ChannelGoneError = Class.new Error
Method execute
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def execute
max_duration = @component_node.max_duration || -1
raise OptionError, 'Record cannot be used on a call that is not answered.' unless @call.answered?
raise OptionError, 'A start-paused value of true is unsupported.' if @component_node.start_paused
- 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 dispatch
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def dispatch(call, callback = nil)
Adhearsion::Events.trigger_immediately :call_routed, call: call, route: self
call_id = call.id # Grab this to use later incase the actor is dead
- 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 output.rb
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'adhearsion/uri_list'
module Adhearsion
module Rayo
module Component
Method execute
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute
raise OptionError, 'An SSML document is required.' unless @component_node.render_documents.first.value
raise OptionError, 'An interrupt-on value of speech is unsupported.' if @component_node.interrupt_on == :voice
[:start_offset, :start_paused, :repeat_interval, :max_time].each do |opt|
Class Dial
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Dial
attr_accessor :status
def initialize(to, options, call)
raise Call::Hangup unless call.active?