Showing 20 of 20 total issues
Method initialize
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def initialize(input)
# allow filename, string, and IO objects as input
if input.kind_of?(String)
if File.exists?(input)
input = File.new(input, 'r')
- 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 run
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
# initialize support groups
@support_groups.values.each do |sg|
sg.initialize_at(@configuration.start_time)
Method initialize
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def initialize(type, params={})
case type
when :predefined
# get workshift id
raise ArgumentError unless params[:id]
- 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 merge
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def merge(sg1_name, sg2_name, new_name=nil)
# raise error if support groups do not exist
raise RuntimeError unless sg1_probs = @transition_probabilities.delete(sg1_name) and
sg2_probs = @transition_probabilities.delete(sg2_name)
- 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 calculate_kpis
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def calculate_kpis(trace)
raise ArgumentError, 'Argument must be a TraceCollector' unless TraceCollector === trace
kpis = {}
- 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 run
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def run
# initialize support groups
@support_groups.values.each do |sg|
sg.initialize_at(@configuration.start_time)
- 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 secs_to_end_of_shift
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def secs_to_end_of_shift(time)
raise 'secs_to_end_of_shift called for unavailable operator' unless active_at?(time)
return Infinity if @type == :all_day_long
t = time.utc.seconds_since_midnight.round
- 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 initialize
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(input)
# allow filename, string, and IO objects as input
if input.kind_of?(String)
if File.exists?(input)
input = File.new(input, 'r')
Method calculate_kpis
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def calculate_kpis(trace)
raise ArgumentError, 'Argument must be a TraceCollector' unless TraceCollector === trace
kpis = {}
Method merge
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def merge(sg1_name, sg2_name, new_name=nil)
# raise error if support groups do not exist
raise RuntimeError unless sg1_probs = @transition_probabilities.delete(sg1_name) and
sg2_probs = @transition_probabilities.delete(sg2_name)
Method try_to_allocate_operator
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def try_to_allocate_operator(time)
if !@available_operators.empty? and !@incident_queue.empty?
op = @available_operators.shift
i, inc_info, t = @incident_queue.shift
Method insert
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def insert(i, v)
if size == 0 or v < self[0]
super(0, v)
elsif v > self[-1]
super(-1, v)
- 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 evaluate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def evaluate(kpis)
# evaluate operation costs
operations_cost = @configuration.support_groups.inject(0.0) do |sum,(sg_name,sg_conf)|
sg_costs = @configuration.cost_analysis[:operations].find{|sg| sg[:sg_name] == sg_name }
unless sg_costs
- 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 calculate_time_at_last_support_group
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def calculate_time_at_last_support_group(*types)
time = 0
last_sg = nil
@tracking_information.reverse_each do |ti|
last_sg ||= ti[:sg]
- 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 secs_to_begin_of_shift
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def secs_to_begin_of_shift(time)
raise 'secs_to_begin_of_shift called for available operator' if active_at?(time)
t = time.utc.seconds_since_midnight.round
res = if @overnight
- 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 calculate_time
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def calculate_time(type)
return 0 unless @tracking_information
@tracking_information.inject(0){|sum,x| sum += ((type == :all || type == x[:type]) ? x[:duration].to_i : 0) }
end
- 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 assign
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def assign(incident, incident_info, time)
# initialize incident start work time if needed
incident.start_work_time ||= time
- 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 to_s
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_s
lines = [ "From/To,#{@sg_names.join(',')},Out" ]
[ "In", *@sg_names ].each do |input_sg|
escalations = [ @sg_names, "Out" ].flatten!.map do |output_sg|
@transition_probabilities[input_sg].map{|x| x[:sg_name] == output_sg ? x[:escalations] : nil }.compact.first || 0
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(oid, support_group_id, opts={})
@oid = oid
@support_group_id = support_group_id
# set correspondent instance variables for optional arguments
- 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 try_to_allocate_operator
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def try_to_allocate_operator(time)
if !@available_operators.empty? and !@incident_queue.empty?
op = @available_operators.shift
i, inc_info, t = @incident_queue.shift
- 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"