Showing 5 of 5 total issues
Class AMI
has 46 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class AMI
attr_accessor :host, :port, :connected, :timeout, :wait_time
def initialize(host, port)
self.host = host.to_s
Method originate
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def originate(channel, context, callee, priority, variable = nil, caller_id = nil, timeout = 30000, async = nil)
Method redirect
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def redirect(channel, context, callee, priority, variable=nil, caller_id = nil, timeout = 30000)
Method _parse_objects
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
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 = {}
- 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 queue_add
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def queue_add(queue, exten, penalty = 2, paused = false, member_name = '')