Showing 159 of 283 total issues
Method add_user_to_csv
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_user_to_csv(csv, school_group, school, user)
csv << [
school_group.name,
school.present? ? school.name : 'N/A',
user.name,
- 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_benchmarks_for_latest_run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_benchmarks_for_latest_run(latest_school_runs, benchmarks)
latest_school_runs.each do |benchmark_result_school_generation_run|
school_id = benchmark_result_school_generation_run.school_id
benchmark_result_school_generation_run.benchmark_results.pluck(result_column).each do |benchmark_result|
- 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 no_overlaps
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def no_overlaps
if start_date && end_date && calendar_event_type
overlap_types = if calendar_event_type.term_time || calendar_event_type.holiday
(CalendarEventType.holiday + CalendarEventType.term)
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
Function processAnalysisOperations
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function processAnalysisOperations(chartConfig, chart, operations, drilldownAvailable, parentTimescaleDescription){
var chartContainer = $(chart.renderTo);
var controls = $(chartContainer).parent().find('.analysis-controls');
var anyOperations = false;
if(controls.length){
- 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_interests
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_interests(user, list)
ret = {}
items = []
items << user.school_group_name if user.school_group_name
items << user.staff_role.title if user.staff_role
- 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 select_y_axis
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def select_y_axis
choices = y1_axis_choices
return nil if choices.nil?
case @school.chart_preference.to_sym
when :default
- 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 create_multi_chart
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_multi_chart(results, names, multiplier, y_axis_label, **kwargs)
Function processAnalysisOperations
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function processAnalysisOperations(chartConfig, chart, operations, drilldownAvailable, parentTimescaleDescription){
Method create!
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create!(meter_id, attribute_type, input_data, reason, user)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(school, alert_report, alert_generation_run, alert_type, asof_date)
Method options_from_collection_for_select_with_data
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def options_from_collection_for_select_with_data(collection, value_method, text_method, selected = nil, data = {})
Function setUpDatePicker
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function setUpDatePicker(divId, inputId, maxMin, defaultDate, period) {
Method format_body
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def format_body(email, tags, interests, merge_fields, status = 'subscribed')
Method readings
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def readings(mpxn, fuel_type, reading_type, start_date = nil, end_date = nil)
Method resource_data
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def resource_data(name, slug, project_id, categories, priority)
Method show
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def show
framework_adapter = Alerts::FrameworkAdapter.new(
alert_type: @alert_type,
school: @school,
analysis_date: @page.alert.run_on,
- 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 update_previous_events
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_previous_events(calendar_event, pre_save, post_save)
previous_event = @calendar.terms_and_holidays.find_by(end_date: calendar_event.start_date_was - 1.day)
if previous_event
callback = calendar_event.start_date > calendar_event.start_date_was ? post_save : pre_save
new_event_end = calendar_event.start_date - 1.day
- 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 perform
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def perform
# if n3rgy dont provide us with dates, we can't load data
return if available_date_range.empty?
# determine start/end dates for API request, allowing for
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def convert(val)
return val if val.nil? || !needs_conversion?(val)
if [true, false].include? val
val.to_s
- 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 update_following_events
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_following_events(calendar_event, pre_save, post_save)
following_event = @calendar.terms_and_holidays.find_by(start_date: calendar_event.end_date_was + 1.day)
if following_event
callback = calendar_event.end_date > calendar_event.end_date_was ? pre_save : post_save
new_event_start = calendar_event.end_date + 1.day
- 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"