ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

Method exp_add_joiner has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def exp_add_joiner(exp, token, joiner)
    if exp[:token] && exp[:token] == token                # If the token matches
      exp.keys.each do |key|                              # Find the key
        if key == :token
          exp.delete(key)                                 # Remove the :token key
Severity: Minor
Found in app/controllers/application_controller/filter.rb - About 1 hr to fix

Method exp_build_string has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def exp_build_string(exp)
    main_font = calculate_font_color(exp['result'])

    if exp['and']
      exp_string = join_binary(exp, 'and', main_font)
Severity: Minor
Found in app/controllers/application_controller/expression_html.rb - About 1 hr to fix

Method button_set_record_vars has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def button_set_record_vars(button)
    button.name = @edit[:new][:name]
    button.description = @edit[:new][:description]
    button.applies_to_class = x_active_tree == :ab_tree ? @resolve[:target_class] : "ServiceTemplate"
    button.applies_to_id = x_active_tree == :ab_tree ? nil : @sb[:applies_to_id]
Severity: Minor
Found in app/controllers/application_controller/buttons.rb - About 1 hr to fix

Method adv_search_clear has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def adv_search_clear
    respond_to do |format|
      format.js do
        @explorer = true
        if x_active_tree.to_s =~ /_filter_tree$/ &&
Severity: Minor
Found in app/controllers/application_controller/advanced_search.rb - About 1 hr to fix

Method fetch_saved_report has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def fetch_saved_report(id)
    rr = MiqReportResult.for_user(current_user).find_by(:id => id)
    if rr.nil? # Saved report no longer exists
      @report = nil
      add_flash(_("Error: Report no longer exists in the database"), :error)
Severity: Minor
Found in app/controllers/chargeback_report_controller.rb - About 1 hr to fix

Method timeprofile_set_days_hours has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def timeprofile_set_days_hours(_timeprofile = @timeprofile)
    @timeprofile_details = {}
    @timeprofiles.each do |timeprofile|
      @timeprofile_details[timeprofile.description] = {}
      profile_key = timeprofile.profile[:days].nil? ? "days" : :days
Severity: Minor
Found in app/controllers/configuration_controller.rb - About 1 hr to fix

Method forest_accept has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def forest_accept
    assert_privileges("ops_settings")

    forest_get_form_vars
    no_changes = true
Severity: Minor
Found in app/controllers/ops_controller/settings.rb - About 1 hr to fix

Method ap_get_form_vars has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def ap_get_form_vars
    @scan = @edit[:scan_id] ? ScanItemSet.find(@edit[:scan_id]) : ScanItemSet.new
    @edit[:new][:name]        = params[:name]        if params[:name]
    @edit[:new][:description] = params[:description] if params[:description]

Severity: Minor
Found in app/controllers/ops_controller/settings/analysis_profiles.rb - About 1 hr to fix

Method action_handle_selection_buttons has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def action_handle_selection_buttons(members,
                                      members_chosen = :members_chosen,
                                      choices = :choices,
                                      choices_chosen = :choices_chosen)
    if params[:button].ends_with?("_left")
Severity: Minor
Found in app/controllers/miq_action_controller.rb - About 1 hr to fix

Method miq_alert_set_assign has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def miq_alert_set_assign
    assert_privileges("miq_alert_set_assign")
    @assign = @sb[:assign]
    @alert_profile = @assign[:alert_profile] if @assign
    case params[:button]
Severity: Minor
Found in app/controllers/miq_alert_set_controller.rb - About 1 hr to fix

Method deleteemss has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def deleteemss
      assert_privileges(params[:pressed])
      emss = []
      if @lastaction == "show_list" # showing a list, scan all selected emss
        emss = find_checked_items
Severity: Minor
Found in app/controllers/mixins/ems_common.rb - About 1 hr to fix

Method show_details has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def show_details(db, options = {})
      association = options[:association]
      scopes = options[:scopes]
      @showtype = "details"
      @display = "main"
Severity: Minor
Found in app/controllers/mixins/explorer_show.rb - About 1 hr to fix

Method scaling has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def scaling
    assert_privileges("ems_infra_scale")

    # Hiding the toolbars
    @in_a_form = true
Severity: Minor
Found in app/controllers/ems_infra_controller.rb - About 1 hr to fix

Method reports_get_node_info has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def reports_get_node_info
    nodes = x_node.split('-')

    if nodes.length == 2
      @right_cell_text ||= _("%{typ} Reports") % {:typ => @sb[:rpt_menu][nodes[1].to_i][0]}
Severity: Minor
Found in app/controllers/report_controller.rb - About 1 hr to fix

Method explorer has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def explorer
    @explorer = true
    @lastaction      = "explorer"
    @ght_type        = nil
    @report          = nil
Severity: Minor
Found in app/controllers/report_controller.rb - About 1 hr to fix

Method update has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def update(params)
      if params[:chosen_pivot1] && params[:chosen_pivot1] != by1
        self.by1 = params[:chosen_pivot1]
        if params[:chosen_pivot1] == NOTHING_STRING
          self.by2 = NOTHING_STRING
Severity: Minor
Found in app/controllers/report_controller/pivot_options.rb - About 1 hr to fix

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

  def textual_group_options
    options = []

    DDF.traverse(:fields => @record.class::API_ATTRIBUTES) do |field|
      next if field[:type].to_s == 'password' || field[:name].nil?
Severity: Major
Found in app/helpers/ansible_credential_helper/textual_summary.rb and 1 other location - About 1 hr to fix
app/helpers/workflow_credential_helper/textual_summary.rb on lines 12..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 62.

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

  def textual_group_options
    options = []

    DDF.traverse(:fields => @record.class::API_ATTRIBUTES) do |field|
      next if field[:type].to_s == 'password' || field[:name].nil?
Severity: Major
Found in app/helpers/workflow_credential_helper/textual_summary.rb and 1 other location - About 1 hr to fix
app/helpers/ansible_credential_helper/textual_summary.rb on lines 12..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 62.

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 groups
      return unless init_show_variables

      @lastaction = "groups"
      id = params[:show] || params[:x_show]
Severity: Major
Found in app/controllers/mixins/explorer_show.rb and 1 other location - About 1 hr to fix
app/controllers/mixins/explorer_show.rb on lines 125..139

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 62.

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 users
      return unless init_show_variables

      @lastaction = "users"
      id = params[:show] || params[:x_show]
Severity: Major
Found in app/controllers/mixins/explorer_show.rb and 1 other location - About 1 hr to fix
app/controllers/mixins/explorer_show.rb on lines 107..121

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 62.

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

Severity
Category
Status
Source
Language