Showing 162 of 288 total issues
Method find_and_mirror_entry_for
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def find_and_mirror_entry_for(key, options)
entry = lookup('en', key, options[:scope], options)
entry = entry.dup if entry.is_a?(String)
entry = pluralize('en', entry, options[:count]) if options[:count]
- 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 include_fuel_type_in_suggestions?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def include_fuel_type_in_suggestions?(fuel_type)
return false unless school_target
return false unless @school.configuration.suggest_annual_estimate_for_fuel_type?(fuel_type)
target_start_date = school_target.start_date
fuel_type_start = @school.configuration.meter_start_date(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"
Further reading
Method resolve_value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def resolve_value(record, value)
case value
when Proc
if value.arity == 0
value.call
- 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
Avoid too many return
statements within this method. Open
return alert_type_rating.email_active?
Avoid too many return
statements within this method. Open
return alert_type_rating.sms_active?
Avoid too many return
statements within this method. Open
return series_key_as_string unless i18n_key
Avoid too many return
statements within this method. Open
return translate_bill_component_series(series_key_as_string) if I18n.t('advice_pages.tables.labels.bill_components').keys.map(&:to_s).include?(series_key_as_string)
Avoid too many return
statements within this method. Open
return :£ if choices.include?(:£)
Method for_storage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private_class_method def self.for_storage(val)
return val if val.nil? || !needs_conversion?(val)
if val.infinite? == 1
'.inf'
elsif val.infinite? == -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 overlapping
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def overlapping(usage_type)
day = overlapping_days
calendar_period = overlapping_calendar_periods
overlapping = false
school.school_times.each do |other|
- 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 produce_csv_row_automatic
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def produce_csv_row_automatic(school_onboarding, state)
last_event = school_onboarding.events.order(event: :desc).first
[
school_onboarding.school_name,
state,
- 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 customise_y_axis
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def customise_y_axis(new_config, overrides)
if overrides[:y_axis_units]
overrides[:y_axis_units] = :£ if overrides[:y_axis_units] == :gb_pounds
# not using service here as we're applying the users direct selection of axis
valid_choices = ChartYAxisManipulation.new.y1_axis_choices(@original_config)
- 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 summary_hash
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def summary_hash(status, one_day_kwh)
if status == 'ORIG'
description = 'ORIG, uncorrected good data'
colour = '#5cb85c'
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 full_previous_week?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def full_previous_week?
return false unless full_last_week?
return false unless previous_week_date_range.any?
return false unless aggregate_meter.amr_data.start_date <= previous_week_date_range.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 tags
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def tags
ret = []
if @school.percentage_free_school_meals
percent = @school.percentage_free_school_meals
if percent >= 30
- 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 sort_query_results_by
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.sort_query_results_by(mpans, query_results)
mpans.uniq.each_with_object([]) do |mpan, rows|
next if mpan.empty?
rows_for_mpan = query_results.select { |result| result['mpan_mprn'] == mpan }
- 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 find_possible_time_range_gaps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.find_possible_time_range_gaps
existing_time_ranges = all.order(:start_time).map(&:time_range)
possible_time_range_gaps = []
existing_time_ranges.each_with_index do |time_range, index|
- 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_missing_array
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_missing_array(first_reading, reading_summary)
missing_array = (first_reading.at.to_date..Time.zone.today).collect do |day|
if ! reading_summary.key?(day)
[day, 'No readings']
elsif reading_summary.key?(day) && reading_summary[day] < 48
- 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 determine_start_date
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def determine_start_date
return @override_start_date if @override_start_date
return nil if available_date_range.empty?
start = available_date_range.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 show_data_enabled_features?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def show_data_enabled_features?
if current_user && current_user.admin?
params[:no_data] ? false : true
else
@school.data_enabled?
- 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"