Method apply_selects
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def apply_selects(activities, selects, grouped = false)
return activities if selects.empty?
# We use map+reject(blank) so that we can modify the activities in the
# groups
activities = activities.lazy.map do |act|
- 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 strip_unenriched
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def strip_unenriched(activities, includes)
activities.map do |act|
if act['activities'] # Recurse into activity groups
act['activities'] = strip_unenriched(act['activities'], includes)
else
- 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 strip_unused
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def strip_unused(activity_groups)
activity_groups.each do |group|
return activity_groups unless group['activities']
next unless STRIPPED_VERBS.include?(group['verb'])
group['activities'] = [group['activities'].first]
- 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_a
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Wontfix
def to_a
res = data
return [] unless data
res = apply_selects(res, opts[:fast_selects] || [])
res = strip_unused(res)
- 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"