adhearsion/adhearsion

View on GitHub

Showing 81 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
Severity: Minor
Found in lib/adhearsion/translator/asterisk/component/mrcp_recog_prompt.rb - About 1 day 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

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
Severity: Minor
Found in lib/adhearsion/call.rb - About 6 hrs to fix

    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
    
    
    Severity: Minor
    Found in lib/adhearsion/translator/asterisk/call.rb - About 5 hrs 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

    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'
    Severity: Minor
    Found in lib/adhearsion/call.rb - About 4 hrs to fix

      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
      Severity: Minor
      Found in lib/adhearsion/translator/asterisk/call.rb - About 4 hrs to fix

        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
        Severity: Minor
        Found in lib/adhearsion/translator/asterisk/call.rb - About 4 hrs 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 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|
        Severity: Minor
        Found in lib/adhearsion/translator/asterisk/component/output.rb - About 4 hrs 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

        Class CallController has 33 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class CallController
            include Dial
            include Input
            include Output
            include Record
        Severity: Minor
        Found in lib/adhearsion/call_controller.rb - About 4 hrs to fix

          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
          
          
          Severity: Minor
          Found in lib/adhearsion/call_controller/dial.rb - About 3 hrs 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

          Class Call has 31 methods (exceeds 20 allowed). Consider refactoring.
          Open

                class Call
                  include HasGuardedHandlers
          
                  InvalidCommandError = Class.new Error
          
          
          Severity: Minor
          Found in lib/adhearsion/translator/asterisk/call.rb - About 3 hrs to fix

            File dial.rb has 325 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'countdownlatch'
            
            module Adhearsion
              class CallController
                module Dial
            Severity: Minor
            Found in lib/adhearsion/call_controller/dial.rb - About 3 hrs to fix

              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
              Severity: Major
              Found in lib/adhearsion/translator/asterisk/call.rb - About 3 hrs to fix

                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
                
                
                Severity: Major
                Found in lib/adhearsion/translator/asterisk/call.rb - About 3 hrs to fix

                  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"
                  Severity: Major
                  Found in lib/adhearsion/configuration.rb - About 3 hrs to fix

                    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
                    Severity: Minor
                    Found in lib/adhearsion/translator/asterisk.rb - About 3 hrs to fix

                      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
                      Severity: Minor
                      Found in lib/adhearsion/translator/asterisk/component/record.rb - About 2 hrs 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 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
                      
                      
                      Severity: Minor
                      Found in lib/adhearsion/router/route.rb - About 2 hrs 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

                      File output.rb has 287 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require 'adhearsion/uri_list'
                      
                      module Adhearsion
                        module Rayo
                          module Component
                      Severity: Minor
                      Found in lib/adhearsion/rayo/component/output.rb - About 2 hrs to fix

                        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|
                        Severity: Major
                        Found in lib/adhearsion/translator/asterisk/component/output.rb - About 2 hrs to fix

                          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?
                          Severity: Minor
                          Found in lib/adhearsion/call_controller/dial.rb - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language