adhearsion/adhearsion

View on GitHub
lib/adhearsion/call_controller/dial.rb

Summary

Maintainability
D
1 day
Test Coverage

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

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

    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

      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
      
      
      Severity: Minor
      Found in lib/adhearsion/call_controller/dial.rb - About 1 hr to fix

        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
        Severity: Minor
        Found in lib/adhearsion/call_controller/dial.rb - About 1 hr 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 split has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

                def split(targets = {})
                  @splitting = true
                  calls_to_split = @calls.map do |call|
                    ignoring_ended_calls do
                      [call.id, call] if call.active?
        Severity: Minor
        Found in lib/adhearsion/call_controller/dial.rb - About 1 hr 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 split has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def split(targets = {})
                  @splitting = true
                  calls_to_split = @calls.map do |call|
                    ignoring_ended_calls do
                      [call.id, call] if call.active?
        Severity: Minor
        Found in lib/adhearsion/call_controller/dial.rb - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status