lib/hqmf-parser/converter/pass2/comparison_converter.rb
Method walk_up_tree
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
Open
def walk_up_tree(preconditions)
preconditions.each do |precondition|
if (has_child_comparison(precondition))
walk_up_tree(precondition.preconditions)
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 walk_up_tree
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def walk_up_tree(preconditions)
preconditions.each do |precondition|
if (has_child_comparison(precondition))
walk_up_tree(precondition.preconditions)
end
Avoid deeply nested control flow statements. Open
Open
if operator.field.downcase == 'status'
# only set the status if we don't have one. We trust the template ID statuses more than the restrictions
new_data_criteria.status ||= operator.value.code
elsif operator.field.downcase == 'result value' or operator.field.downcase == 'result'
puts "\tREFR result value is nil: #{new_data_criteria.title}" if (operator.value.nil?)
Method get_child_comparisons
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_child_comparisons(node)
values = []
node.preconditions.each do |precondition|
if (precondition.comparison?)
values << precondition
- 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"