Method evaluate_goal_compliance
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def evaluate_goal_compliance(goals_hash)
atk_arr, pred_arr = goals_hash.partition{|p| p[0].type == :atk}
value_hash = Hash.new
pred_arr.each do |pred, value|
return false if pred.positive && !value
- 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_goal_compliance_dr
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def evaluate_goal_compliance_dr(goals_hash, agent, public_space)
atk_arr, pred_arr = goals_hash.partition{|p| !agent.goals.include? p[0]}
value_hash = Hash.new
pred_arr.each do |pred, value|
return false if pred.positive && !value
- 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 get_goal_full_set
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_goal_full_set(agent, public_space)
set = Set.new
arg_set = Set.new
set.merge(agent.goals)
arg_set.merge(agent.goals)
- 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 is_true_dr?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def is_true_dr?(predicate, atk_arr, value_hash, public_space, stack)
return value_hash[predicate] if value_hash.include?(predicate)
atk_arr.lazy.select{|atk| public_space.backup_attacks.include?(Predicate.new(:atk, atk[0].argument1, arg2:predicate.argument1)) && stack.none?{|p| atk[0].argument1 != p.argument1}}.each do |atk|
next unless atk[1]
stack.unshift atk[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 is_true?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def is_true?(predicate, atk_arr, value_hash, stack)
return value_hash[predicate] if value_hash.include?(predicate)
atk_arr.lazy.select{|atk| (atk[0].argument2 == predicate.argument1) && stack.none?{|p| atk[0].argument1 != p.argument1 && atk[0].argument2 != p.argument2}}.each do |atk|
next unless atk[1]
stack.unshift atk[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 is_true_dr?
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def is_true_dr?(predicate, atk_arr, value_hash, public_space, stack)
Method compatible?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def compatible?(rule, instance, prem_arr)
premisses = []
prem_arr.drop(1).each_with_index do |prem, prem_i|
next unless rule.premises.map(&:unsided).include?(prem)
if instance[prem_i+2] == "s0"
- 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 build_cond_prob
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_cond_prob(xml, var, parent, *instances)
xml.CondProb {
xml.Var var
xml.Parent parent
xml.Parameter(:type => "TBL") {
- 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"