Showing 30 of 30 total issues
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 remove_irrelevant_args
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def remove_irrelevant_args(aps, verbose)
if verbose
puts "\n--> Applying irrelevant arguments optimization:"
end
remove = ->(set, num="") do
- 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 optimize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def optimize(aps, verbose=true, cycle=true, optimizations=[])
aps if optimizations.include?(:none)
flags_list = [:irrelevant, :initial, :enthymeme, :dominated]
(f = (optimizations - flags_list)) and (raise "Unknown flags :#{f} Known flags are #{flags_list}" unless f.empty?)
optimizations = flags_list if optimizations.empty?
- 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?
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def is?(type, arg1, arg2=nil, positive=true, owner=1)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(arguments, rules, initial_state, goals=[[],[]], action_names=nil)
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 build_agent_side_transitions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_agent_side_transitions(xml, agent, predicate, modifying_actions)
prem_set = Set.new
prem_set.add(predicate.unsided)
modifying_actions.each do |act_i, _|
prem_set.merge(agent.actions[act_i].premises.map(&:unsided))
- 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 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"