Showing 151 of 266 total issues
Method report
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def report
report = {}
fuel_type_report = {
enough_data: false,
recent_data: 'N/A',
- 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 chartSuccess
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function chartSuccess(chartConfig, chartData, chart) {
var $chartDiv = $(chart.renderTo);
var chartType = chartData.chart1_type;
var seriesData = chartData.series_data;
- 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 a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. 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 csv
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def csv
CSV.generate(headers: true) do |csv|
csv << self.class.csv_headers
school_ids = School.active.pluck(:id) + School.archived.pluck(:id)
Method report
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def report
report = {}
fuel_type_report = {
enough_data: false,
recent_data: 'N/A',
Function carbon
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const carbon = ( function() {
var local = {
neutral: '',
equivalences: '',
Method process
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def process
return self if @chart.nil?
@x_data_hash = reverse_x_data_if_required
@series_data = []
- 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 remove_users!
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def remove_users!
raise SchoolRemover::Error.new('Cannot remove users while school is still visible') if @school.visible?
@school.transaction do
@school.users.each do |user|
- 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 based_on_energy_use
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def based_on_energy_use(limit = NUMBER_OF_SUGGESTIONS)
alerts = alerts_by_fuel_type
fuel_types = alerts.keys
suggestions = []
- 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 column_or_bar
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def column_or_bar
@series_data = @x_data_hash.each_with_index.map do |(data_type, data), index|
data_type = tidy_label(data_type)
colour = work_out_best_colour(data_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
Function processAnalysisChartAjax
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function processAnalysisChartAjax(chartId, chartConfig, highchartsChart) {
var chartType = chartConfig.type;
var yAxisUnits = chartConfig.y_axis_units;
var mpanMprn = chartConfig.mpan_mprn;
var seriesBreakdown = chartConfig.series_breakdown;
Method series_translation_key_lookup
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def series_translation_key_lookup
@series_translation_key_lookup ||= {
Series::DegreeDays::DEGREEDAYS => Series::DegreeDays::DEGREEDAYS_I18N_KEY,
Series::Temperature::TEMPERATURE => Series::Temperature::TEMPERATURE_I18N_KEY,
Series::DayType::SCHOOLDAYCLOSED => Series::DayType::SCHOOLDAYCLOSED_I18N_KEY,
Method export
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def export
service = CategoriseSchools.new(schools: @schools)
CSV.generate(headers: true) do |csv|
csv << headers
service.categorise_schools.each do |fuel_type, advice_pages|
- 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 processAnnotations
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function processAnnotations(loaded_annotations, chart){
var xAxis = chart.xAxis[0];
var xAxisCategories = xAxis.categories;
var annotations = loaded_annotations.map(function(annotation){
Method csv_headers
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def csv_headers
[
'School group',
'School name',
'School type',
Method perform
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform
transifex_load = TransifexLoad.create!(status: :running)
begin
log('Synchronising Activity Types')
synchronise_resources(transifex_load, ActivityType.tx_resources)
Method export
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def export
CSV.generate(headers: true) do |csv|
csv << headers
@scored_schools.with_points.schools_with_positions.each do |position, schools|
schools.each do |school|
- 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_chart
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def create_chart(results, metric_to_translation_key, multiplier, y_axis_label,
column_heading_keys: 'analytics.benchmarking.configuration.column_headings',
y_axis_keys: 'chart_configuration.y_axis_label_name')
chart_data = {}
schools = []
- 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 extract_readings
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def extract_readings(readings)
data = {}
readings.each do |reading|
datetime = DateTime.parse(reading['from'])
carbon = reading['intensity']['actual']
- 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 35 lines of code (exceeds 25 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){