app/controllers/comparisons/base_controller.rb
Class BaseController
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class BaseController < ApplicationController
include UserTypeSpecific
skip_before_action :authenticate_user!
before_action :filter
Method create_chart
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
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 create_single_number_chart
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def create_single_number_chart(results, name, multiplier, series_name, y_axis_label, **kwargs)
Method create_multi_chart
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def create_multi_chart(results, names, multiplier, y_axis_label, **kwargs)