Method group_by_half_hour
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def group_by_half_hour(school_data_array)
by_half_hour = Hash.new do |h1, day_type|
h1[day_type] = Hash.new do |h2, month|
h2[month] = Hash.new do |h3, half_hour|
h3[half_hour] = []
- 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 average_by_type_within_rank_range
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def average_by_type_within_rank_range(by_school_type, rank_range, fuel_type)
averages = Hash.new do |h1, school_type|
h1[school_type] = Hash.new do |h2, day_type|
h2[day_type] = Hash.new do |h3, month|
h3[month] = []
- 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_meter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_meter(school, fuel_type)
return unless SCHOOL_TYPES.include?(school.school_type.to_sym)
meter = school.aggregate_meter(fuel_type)
- 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"