BathHacked/energy-sparks

View on GitHub

Showing 258 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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

          error: function(jqXHR, textStatus, errorThrown){
            pane.find('.loading').hide();
            pane.find('.content').html('<div class="alert alert-danger">Preview failed</div>');
          },
    Severity: Minor
    Found in app/assets/javascripts/content.js and 1 other location - About 45 mins to fix
    app/assets/javascripts/content.js on lines 41..44

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

          error: function(jqXHR, textStatus, errorThrown){
            pane.find('.loading').hide();
            pane.find('.content').html('<div class="alert alert-danger">Preview failed</div>');
          },
    Severity: Minor
    Found in app/assets/javascripts/content.js and 1 other location - About 45 mins to fix
    app/assets/javascripts/content.js on lines 15..18

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      class AnnualHeatingCostsPerFloorAreaController < BaseController
        private
    
        def headers
          [
    app/controllers/comparisons/recent_change_in_baseload_controller.rb on lines 2..29

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 40.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      class RecentChangeInBaseloadController < BaseController
        private
    
        def headers
          [
    app/controllers/comparisons/annual_heating_costs_per_floor_area_controller.rb on lines 2..29

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 40.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            mouseOutDay: function(e) {
              if(e.events.length > 0) {
                $(e.element).popover('hide');
              }
            },
    Severity: Minor
    Found in app/assets/javascripts/calendar_year_view.js and 1 other location - About 40 mins to fix
    app/assets/javascripts/calendar_year_view.js on lines 174..178

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 49.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            mouseOutDay: function(e) {
              if(e.events.length > 0) {
                $(e.element).popover('hide');
              }
            },
    Severity: Minor
    Found in app/assets/javascripts/calendar_year_view.js and 1 other location - About 40 mins to fix
    app/assets/javascripts/calendar_year_view.js on lines 120..124

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 49.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def withdraw
          meter = Meter.find_by_mpan_mprn(params[:mpxn])
          service = Meters::DccWithdrawTrustedConsents.new([meter])
          if service.perform
            redirect_back fallback_location: admin_dcc_consents_path, notice: "Consent withdrawn for #{meter.mpan_mprn}"
    Severity: Minor
    Found in app/controllers/admin/dcc_consents_controller.rb and 1 other location - About 40 mins to fix
    app/controllers/admin/dcc_consents_controller.rb on lines 7..14

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 38.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def grant
          meter = Meter.find_by_mpan_mprn(params[:mpxn])
          service = Meters::DccGrantTrustedConsents.new([meter])
          if service.perform
            redirect_back fallback_location: admin_dcc_consents_path, notice: "Consent granted for #{meter.mpan_mprn}"
    Severity: Minor
    Found in app/controllers/admin/dcc_consents_controller.rb and 1 other location - About 40 mins to fix
    app/controllers/admin/dcc_consents_controller.rb on lines 17..24

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 38.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          @low_carbon_hub_installation = Solar::LowCarbonHubInstallationFactory.new(
            school: @school,
            rbee_meter_id: low_carbon_hub_installation_params[:rbee_meter_id],
            username: low_carbon_hub_installation_params[:username],
            password: low_carbon_hub_installation_params[:password],
    app/controllers/schools/solar_edge_installations_controller.rb on lines 21..33

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 38.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          @solar_edge_installation = Solar::SolarEdgeInstallationFactory.new(
            school: @school,
            mpan: solar_edge_installation_params[:mpan],
            site_id: solar_edge_installation_params[:site_id],
            api_key: solar_edge_installation_params[:api_key],
    Severity: Minor
    Found in app/controllers/schools/solar_edge_installations_controller.rb and 1 other location - About 40 mins to fix
    app/controllers/schools/low_carbon_hub_installations_controller.rb on lines 10..22

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 38.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      $(document).on('change','input[data-dependant]',function() {
        let id = $(this).prop('id');
        depends_on(id);
      });
    Severity: Minor
    Found in app/assets/javascripts/depends_on.js and 1 other location - About 40 mins to fix
    app/assets/javascripts/depends_on.js on lines 5..8

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 48.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      $(document).on('change','input[data-dependee]',function() {
        let id = $(this).attr("data-dependee");
        depends_on(id);
      });
    Severity: Minor
    Found in app/assets/javascripts/depends_on.js and 1 other location - About 40 mins to fix
    app/assets/javascripts/depends_on.js on lines 10..13

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 48.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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
                  Severity
                  Category
                  Status
                  Source
                  Language