BathHacked/energy-sparks

View on GitHub
app/controllers/comparisons/base_controller.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Class BaseController has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

  class BaseController < ApplicationController
    include UserTypeSpecific
    skip_before_action :authenticate_user!

    before_action :filter
Severity: Minor
Found in app/controllers/comparisons/base_controller.rb - About 2 hrs to fix

    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 = []
    Severity: Minor
    Found in app/controllers/comparisons/base_controller.rb - About 1 hr to fix

    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

        def create_single_number_chart(results, name, multiplier, series_name, y_axis_label, **kwargs)
    Severity: Minor
    Found in app/controllers/comparisons/base_controller.rb - About 45 mins to fix

      Method create_multi_chart has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def create_multi_chart(results, names, multiplier, y_axis_label, **kwargs)
      Severity: Minor
      Found in app/controllers/comparisons/base_controller.rb - About 35 mins to fix

        There are no issues that match your filters.

        Category
        Status