Showing 81 of 81 total issues
Class Initializer
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Initializer
class << self
def start(*args, &block)
new(*args, &block).start
Class Plugin
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Plugin
METHODS_OPTIONS = {:load => true, :scope => false}
class << self
Class CallController
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class CallController
module Output
PlaybackError = Class.new Adhearsion::Error # Represents failure to play audio, such as when the sound file cannot be found
NoDocError = Class.new Adhearsion::Error # Represents failure to provide documents to playback
Method prep_calls
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def prep_calls
@calls = Set.new
@targets.map do |target, specific_options|
new_call = OutboundCall.new
Method validate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def validate
[:interrupt_on, :start_offset, :start_paused, :repeat_interval, :repeat_times, :max_time].each do |opt|
raise OptionError, "A #{opt} value is unsupported on Asterisk." if output_node.send opt
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 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 init
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def init
self.config = Adhearsion.config.core
username = self.config.username
if (self.config.type || :xmpp) == :xmpp
Method copied_doc
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def copied_doc(original, elements)
doc = RubySpeech::SSML.draw do
if Nokogiri.jruby?
self.write_attr 'version', original.value['version']
self.write_attr 'xml:lang', original.value['xml:lang']
- 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 exec_script_ahn!
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.exec_script_ahn!(args = ARGV)
cwd = Dir.pwd
return unless in_ahn_application? || in_ahn_application_subdirectory?
exec RUBY, SCRIPT_AHN, *args if in_ahn_application?
Dir.chdir("..") do
- 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 t
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def t(key, options = {})
this_locale = options[:locale] || locale
options = {default: '', locale: locale}.merge(options)
prompt = ::I18n.t "#{key}.audio", options
text = ::I18n.t "#{key}.text", options
- 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 take
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def take(call = nil)
case call
when Call
interact_with_call call
when String
Method cleanup_calls
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def cleanup_calls
calls_to_hangup = @calls.map do |call|
ignoring_ended_calls do
[call.id, call] if call.active?
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 take
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def take(call = nil)
case call
when Call
interact_with_call call
when String
- 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 validate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validate
raise OptionError, "The renderer #{renderer} is unsupported." unless renderer == 'asterisk'
raise OptionError, "The recognizer #{recognizer} is unsupported." unless recognizer == 'unimrcp'
raise OptionError, 'A document is required.' unless output_node.render_documents.count > 0
- 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 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 description
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def description(name, args = {:show_values => true})
desc = StringIO.new
name.nil? and name = :core
if name.eql? :all
Method setup_event_handlers
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.setup_event_handlers
Events.rayo(Adhearsion::Event::Offer) do
begin
Celluloid::Actor[:statistics].register_call_offered
ensure
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 validate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate
raise OptionError, "The renderer #{renderer} is unsupported." unless renderer == 'unimrcp'
raise OptionError, "The recognizer #{recognizer} is unsupported." unless recognizer == 'unimrcp'
raise OptionError, 'An SSML document is required.' unless output_node.render_documents.count > 0
raise OptionError, 'Only one document is allowed.' if output_node.render_documents.count > 1
- 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 ami_dispatch_to_or_create_call
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def ami_dispatch_to_or_create_call(event)
calls_for_event = channels_for_ami_event(event).inject({}) do |h, channel|
call = call_for_channel channel
h[channel] = call if call
h
- 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"