Showing 30 of 30 total issues
Method build_public_argument_transitions
has a Cognitive Complexity of 228 (exceeds 5 allowed). Consider refactoring. Open
def build_public_argument_transitions(xml, agent, opponent, modification_hash)
public_or_atks = lambda {|p| p[0].type == :pub || p[0].type == :atk}
modification_hash.lazy.select(&public_or_atks).each do |pred, modif_arrays|
if modif_arrays[1].empty? && !modif_arrays[0].empty? # No modification of the predicate by the opponent
build_agent_side_transitions(xml, agent, pred, modif_arrays[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_incompatible_initial
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def remove_incompatible_initial(aps, verbose)
if verbose
puts "\n--> Applying incompatible initial arguments optimization:"
end
checker = ->(rules, type, suffix, initial) 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 build_public_argument_transitions
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_public_argument_transitions(xml, agent, opponent, modification_hash)
public_or_atks = lambda {|p| p[0].type == :pub || p[0].type == :atk}
modification_hash.lazy.select(&public_or_atks).each do |pred, modif_arrays|
if modif_arrays[1].empty? && !modif_arrays[0].empty? # No modification of the predicate by the opponent
build_agent_side_transitions(xml, agent, pred, modif_arrays[0])
Method remove_enthymemes
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def remove_enthymemes(aps, verbose)
if verbose
puts "\n--> Applying enthymemes optimization:"
end
removed = []
- 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 fill_usage_hashes
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def fill_usage_hashes(aps)
@premises_hash = Hash.new(nil)
@modif_hash = Hash.new(nil)
@user_hash = Hash.new(nil)
- 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_reward
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def build_reward(xml, agent, public_space)
goal_full_set_arr = get_goal_full_set(agent, public_space)
xml.Parent goal_full_set_arr.map{|p| "n" + convert_string(p)}.join(" ")
xml.Parameter(:type => "TBL") {
build_entry(xml, "* " * goal_full_set_arr.size, -1)
- 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_pomdpx
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def build_pomdpx(*parts)
flags_list = [:var, :init, :transitions, :reward]
f = (parts - flags_list) and (raise "Unknown flags :#{f}" unless f.empty?)
parts = flags_list if parts.empty?
Nokogiri::XML::Builder.new(:encoding => "ISO-8859-1") do |xml|
- 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
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 remove_enthymemes
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def remove_enthymemes(aps, verbose)
if verbose
puts "\n--> Applying enthymemes optimization:"
end
removed = []
Method prune_empty_rules
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def prune_empty_rules(aps, verbose)
if verbose
puts "\n--> Pruning empty rules:"
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 initialize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def initialize(type, scope, predicate)
@type = type
@scope = scope
@predicate = predicate
- 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 filter_initial_state
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def filter_initial_state(initial_state)
initial_state.each do |p|
if p.type == :pub
raise "Predicate on unknown argument: #{p}" unless @arguments.include? p.argument1
@initial_state[p.argument1] = true
- 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_dominated
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def remove_dominated(aps, verbose)
if verbose
puts "\n--> Applying dominated arguments optimization:"
end
graph = AtkGraph::Graph.new
- 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 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def remove_irrelevant_args(aps, verbose)
if verbose
puts "\n--> Applying irrelevant arguments optimization:"
end
remove = ->(set, num="") do
Method build_pomdpx
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_pomdpx(*parts)
flags_list = [:var, :init, :transitions, :reward]
f = (parts - flags_list) and (raise "Unknown flags :#{f}" unless f.empty?)
parts = flags_list if parts.empty?
Nokogiri::XML::Builder.new(:encoding => "ISO-8859-1") do |xml|
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 remove_incompatible_initial
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def remove_incompatible_initial(aps, verbose)
if verbose
puts "\n--> Applying incompatible initial arguments optimization:"
end
checker = ->(rules, type, suffix, initial) do
Method remove_dominated
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def remove_dominated(aps, verbose)
if verbose
puts "\n--> Applying dominated arguments optimization:"
end
graph = AtkGraph::Graph.new
Method fill_usage_hashes
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fill_usage_hashes(aps)
@premises_hash = Hash.new(nil)
@modif_hash = Hash.new(nil)
@user_hash = Hash.new(nil)