lib/data_feeds/pv_live_service.rb
Method convert_to_date_to_x48_yield_hash
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
def convert_to_date_to_x48_yield_hash(start_date, end_date, datetime_to_yield_hash)
date_to_halfhour_yields_x48 = {}
missing_date_times = []
too_little_data_on_day = []
interpolator = setup_interpolation(datetime_to_yield_hash)
- 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 convert_to_date_to_x48_yield_hash
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def convert_to_date_to_x48_yield_hash(start_date, end_date, datetime_to_yield_hash)
date_to_halfhour_yields_x48 = {}
missing_date_times = []
too_little_data_on_day = []
interpolator = setup_interpolation(datetime_to_yield_hash)
Method historic_solar_pv_data
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def historic_solar_pv_data(gsp_id, sunrise_sunset_latitude, sunrise_sunset_longitude, start_date, end_date)
Method substitute_missing_days
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def substitute_missing_days(missing_days, data, start_date, end_date)
substitute_days = {}
missing_days.each do |missing_date|
(start_date..(missing_date - 1)).reverse_each do |search_date|
if !substitute_days.key?(missing_date) && data.key?(search_date)
- 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"