adhearsion/adhearsion

View on GitHub

Showing 73 of 81 total issues

Method complete_event= has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def complete_event=(other)
          @mutex.synchronize do
            return if @complete_event_resource.set_yet?
            client.delete_component_registration self if client
            complete!
Severity: Minor
Found in lib/adhearsion/rayo/component/component_node.rb - About 35 mins 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 remove_inactive_call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def remove_inactive_call(call)
      @mutex.synchronize do
        if call_is_dead?(call)
          call_id = key call
          delete call_id if call_id
Severity: Minor
Found in lib/adhearsion/calls.rb - About 35 mins 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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def initialize(output_document, grammars, options)
          input_options = {
            mode: options[:mode] || :dtmf,
            initial_timeout: timeout(options[:timeout] || Adhearsion.config.core.media.timeout),
            inter_digit_timeout: timeout(options[:inter_digit_timeout] || Adhearsion.config.core.media.inter_digit_timeout),
Severity: Minor
Found in lib/adhearsion/call_controller/input/prompt_builder.rb - About 35 mins 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 menu has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def menu(*args, &block)
        raise ArgumentError, "You must specify a block to build the menu" unless block
        options = args.last.kind_of?(Hash) ? args.pop : {}
        prompts = args.flatten.compact

Severity: Minor
Found in lib/adhearsion/call_controller/input.rb - About 25 mins 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 prep_command_for_execution has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def prep_command_for_execution(command, options = {})
          command.connection    = self
          command.target_call_id    ||= options[:call_id]
          command.target_mixer_name ||= options[:mixer_name]
          command.domain            ||= options[:domain]
Severity: Minor
Found in lib/adhearsion/rayo/connection/xmpp.rb - About 25 mins 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 convert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def self.convert(result = ->(e) { raise ChannelGoneError, e.message } )
          yield
        rescue RubyAMI::Error => e
          case e.message
          when 'No such channel', /Channel (\S+) does not exist./
Severity: Minor
Found in lib/adhearsion/translator/asterisk/ami_error_converter.rb - About 25 mins 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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def run(name = nil, opts = {}, &block)
        name = plugin_name unless name
        block_given? or raise ArgumentError, "A block must be passed while defining the Plugin run process"
        opts[:after] ||= runners.last.name unless runners.empty? || runners.find { |i| i.name == opts[:before] }
        Adhearsion::Plugin.runners << Initializer.new(name, self, opts, &block)
Severity: Minor
Found in lib/adhearsion/plugin.rb - About 25 mins 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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def validate
            raise OptionError, 'A grammar document is required.' unless input_node.grammars.first
            raise OptionError, 'Only a single grammar is supported.' unless input_node.grammars.size == 1
            raise OptionError, 'A mode value other than DTMF is unsupported.' unless input_node.mode == :dtmf
          end
Severity: Minor
Found in lib/adhearsion/translator/asterisk/component/input_component.rb - About 25 mins 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 start has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def start
      catch :boot_aborted do
        configure_plugins
        load_lib_folder
        load_app_file
Severity: Minor
Found in lib/adhearsion/initializer.rb - About 25 mins 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 handle_ami_event has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            def handle_ami_event(event)
              if (event.name == 'AsyncAGI' && event['SubEvent'] == 'Exec') || event.name == 'AsyncAGIExec'
                send_complete_event success_reason(event)
                if @component_node.name == 'ASYNCAGI BREAK' && @call.channel_var('ADHEARSION_END_ON_ASYNCAGI_BREAK')
                  @call.handle_hangup_event nil, event.best_time
Severity: Minor
Found in lib/adhearsion/translator/asterisk/component/asterisk/agi_command.rb - About 25 mins 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 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)
Severity: Minor
Found in lib/adhearsion/call.rb - About 25 mins 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 rayo_pages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def rayo_pages
            pages ? pages.map { |p| p.is_a?(Range) ? "#{p.min}-#{p.max}" : p }.join(',') : nil
          end
Severity: Minor
Found in lib/adhearsion/rayo/component/send_fax.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

          def execute
            validate
            output_command.request!
            setup_dtmf_recognizer

Severity: Minor
Found in lib/adhearsion/translator/asterisk/component/composed_prompt.rb - About 25 mins 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

Severity
Category
Status
Source
Language