emilianodellacasa/ruby-asterisk

View on GitHub

Showing 5 of 5 total issues

Class AMI has 46 methods (exceeds 20 allowed). Consider refactoring.
Open

  class AMI
    attr_accessor :host, :port, :connected, :timeout, :wait_time

    def initialize(host, port)
      self.host = host.to_s
Severity: Minor
Found in lib/ruby-asterisk.rb - About 6 hrs to fix

    Method originate has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def originate(channel, context, callee, priority, variable = nil, caller_id = nil, timeout = 30000, async = nil)
    Severity: Major
    Found in lib/ruby-asterisk.rb - About 1 hr to fix

      Method redirect has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def redirect(channel, context, callee, priority, variable=nil, caller_id = nil, timeout = 30000)
      Severity: Major
      Found in lib/ruby-asterisk.rb - About 50 mins to fix

        Method _parse_objects has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def self._parse_objects(response, parse_params)
              object_array = []
              object_regex = Regexp.new(/#{parse_params[:search_for]}\n(.*?)\n\n/m)
              response.scan(object_regex) do |match|
                object = {}
        Severity: Minor
        Found in lib/ruby-asterisk/response_parser.rb - About 45 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 queue_add has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def queue_add(queue, exten, penalty = 2, paused = false, member_name = '')
        Severity: Minor
        Found in lib/ruby-asterisk.rb - About 35 mins to fix
          Severity
          Category
          Status
          Source
          Language