BathHacked/energy-sparks

View on GitHub

Showing 151 of 266 total issues

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 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 = {})
    Severity: Minor
    Found in app/helpers/application_helper.rb - About 35 mins to fix

      Function processAnalysisOperations has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function processAnalysisOperations(chartConfig, chart, operations, drilldownAvailable, parentTimescaleDescription){
      Severity: Minor
      Found in app/assets/javascripts/analysis.js - About 35 mins to fix

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

            def create!(meter_id, attribute_type, input_data, reason, user)
        Severity: Minor
        Found in app/services/meters/meter_attribute_manager.rb - About 35 mins to fix

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

              def initialize(school, alert_report, alert_generation_run, alert_type, asof_date)
          Severity: Minor
          Found in app/services/alerts/alert_attributes_factory.rb - About 35 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

              Function setUpDatePicker has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                function setUpDatePicker(divId, inputId, maxMin, defaultDate, period) {
              Severity: Minor
              Found in app/assets/javascripts/usage_charts.js - About 35 mins to fix

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

                  def format_body(email, tags, interests, merge_fields, status = 'subscribed')
                Severity: Minor
                Found in app/services/mailchimp_api.rb - About 35 mins to fix

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

                      def resource_data(name, slug, project_id, categories, priority)
                  Severity: Minor
                  Found in lib/transifex/client.rb - About 35 mins to fix

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

                        def historic_solar_pv_data(gsp_id, sunrise_sunset_latitude, sunrise_sunset_longitude, start_date, end_date)
                    Severity: Minor
                    Found in lib/data_feeds/pv_live_service.rb - About 35 mins to fix

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

                          def historic_month(system_id, from_month, from_year, to_month, to_year)
                      Severity: Minor
                      Found in lib/data_feeds/geo_api.rb - About 35 mins to fix

                        Method translated_series_item_for has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def translated_series_item_for(series_key_as_string)
                            series_key_as_string = series_key_as_string.to_s
                            return I18n.t('analytics.series_data_manager.series_name.baseload') if series_key_as_string.casecmp('baseload').zero?
                            return I18n.t('advice_pages.benchmarks.benchmark_school') if series_key_as_string == 'benchmark'
                            return I18n.t('advice_pages.benchmarks.exemplar_school') if series_key_as_string == 'exemplar'
                        Severity: Minor
                        Found in app/models/chart_data_values.rb - About 35 mins 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 determine_target_start_date has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def determine_target_start_date
                              return most_recent_target.target_date if most_recent_target.present?
                              target_start_date = default_target_start_date
                              [:electricity, :gas, :storage_heater].each do |fuel_type|
                                service = target_service(aggregate_school, fuel_type)
                        Severity: Minor
                        Found in app/services/targets/school_target_service.rb - About 35 mins 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 same_prices? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def same_prices?
                              if @energy_tariff.flat_rate?
                                @energy_tariff.energy_tariff_prices.first.value == @current_n3rgy_tariff[:flat_rate]
                              elsif @energy_tariff.energy_tariff_prices.count == @current_n3rgy_tariff[:differential].values
                                @current_n3rgy_tariff[:differential].each_value do |period|
                        Severity: Minor
                        Found in app/services/amr/n3rgy_tariff_manager.rb - About 35 mins 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 benchmark has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def self.benchmark(compare: :benchmark_school, fuel_type:)
                                case compare
                                when :benchmark_school
                                  if fuel_type == :electricity
                                    BenchmarkMetrics::BENCHMARK_OUT_OF_HOURS_USE_PERCENT_ELECTRICITY

                        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 send has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def send
                            unless @school.has_school_onboarding_event?(:data_enabled_email_sent)
                              users = @school.activation_users
                              if users.any?
                                target_prompt = include_target_prompt_in_email?
                        Severity: Minor
                        Found in app/services/data_enabled_email_sender.rb - About 35 mins 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

                        Function processAnnotations has a Cognitive Complexity of 7 (exceeds 5 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){
                        Severity: Minor
                        Found in app/assets/javascripts/analysis.js - About 35 mins 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 current_scores has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def current_scores
                            redirect_to school_group_path(@school_group) and return unless @school_group.scorable?
                        
                            setup_scores_and_years(@school_group)
                            respond_to do |format|
                        Severity: Minor
                        Found in app/controllers/school_groups_controller.rb - About 35 mins 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 colours_for_multiple_fuel_type_benchmark has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def colours_for_multiple_fuel_type_benchmark(data_type, category)
                            case data_type
                            when translated_series_item_for('Gas')
                              if benchmark_school_category?(category)
                                Colours.chart_gas_middle
                        Severity: Minor
                        Found in app/models/chart_data_values.rb - About 35 mins 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 perform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def perform
                              ext = File.extname(path_and_file_name)
                        
                              content =
                                if %w(.xlsx .xls).include?(ext)
                        Severity: Minor
                        Found in app/services/amr/data_file_parser.rb - About 35 mins 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

                        Severity
                        Category
                        Status
                        Source
                        Language