ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Avoid deeply nested control flow statements.
Open

              self.exp_skey = nil unless MiqExpression.get_col_operators(exp_field).include?(exp_skey)
Severity: Major
Found in app/controllers/application_controller/filter/expression.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

      elsif %w[rbac_role_add rbac_role_copy rbac_role_edit].include?(@sb[:action])
        action_url = "rbac_role_edit"
        record_id = @edit[:role_id] ? @edit[:role_id] : nil
      elsif %w[rbac_group_add rbac_group_edit].include?(@sb[:action])
        action_url = "rbac_group_edit"
Severity: Major
Found in app/controllers/ops_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          elsif params[field_name]
            fld[field] = params[field_name]
Severity: Major
Found in app/controllers/miq_ae_class_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if @report.graph.present?
              @render_chart = true
              @ght_type = "hybrid"
            else
              @ght_type = "tabular"
Severity: Major
Found in app/controllers/chargeback_report_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        record_id = @edit[:user_id] ? @edit[:user_id] : nil
Severity: Major
Found in app/controllers/ops_controller.rb - About 45 mins to fix

Method policy_edit_reset has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def policy_edit_reset
    @policy = params[:id] ? MiqPolicy.find(params[:id]) : MiqPolicy.new # Get existing or new record
    assert_privileges("miq_policy_#{@policy.id ? "edit" : "new"}")
    @in_a_form = true

Severity: Minor
Found in app/controllers/miq_policy_controller/policies.rb - About 45 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

Avoid deeply nested control flow statements.
Open

            fld[field] = params[field_name] if params[field_name]
Severity: Major
Found in app/controllers/miq_ae_class_controller.rb - About 45 mins to fix

Method form_copy_objects_field_changed has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def form_copy_objects_field_changed
    assert_privileges(feature_by_action)
    return unless load_edit("copy_objects__#{params[:id]}", "replace_cell__explorer")

    copy_objects_get_form_vars
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 45 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 miq_policy_edit_events has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def miq_policy_edit_events
    assert_privileges('miq_policy_events_assignment')
    case params[:button]
    when "cancel"
      @sb[:action] = @edit = nil
Severity: Minor
Found in app/controllers/miq_policy_controller/policies.rb - About 45 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 ce_select has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def ce_select
    assert_privileges("region_edit")

    ce_get_form_vars
    if params[:id] == "new"
Severity: Minor
Found in app/controllers/ops_controller/settings/tags.rb - About 45 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

Avoid deeply nested control flow statements.
Open

            fld[field] = params["fields_password_value_#{i}".to_sym] if params["fields_password_value_#{i}".to_sym]
Severity: Major
Found in app/controllers/miq_ae_class_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        if %w[ap_copy ap_edit ap_host_edit ap_vm_edit].include?(@sb[:action])
          action_url = "ap_edit"
          record_id = @edit[:scan_id] ? @edit[:scan_id] : nil
        elsif %w[schedule_add schedule_edit].include?(@sb[:action])
          action_url = "schedule_edit"
Severity: Major
Found in app/controllers/ops_controller.rb - About 45 mins to fix

Method copy_save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def copy_save
    assert_privileges(feature_by_action)
    return unless load_edit("copy_objects__#{params[:id]}", "replace_cell__explorer")

    begin
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 45 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

Avoid deeply nested control flow statements.
Open

      elsif @sb[:active_tab] == "settings_tags" && @sb[:active_subtab] == "settings_co_categories" && @in_a_form
        action_url = "category_edit"
        record_id = @category.try(:id)
      elsif @sb[:active_tab] == "settings_tags" && @sb[:active_subtab] == "settings_label_tag_mapping" && @in_a_form
        action_url = "label_tag_mapping_edit"
Severity: Major
Found in app/controllers/ops_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            self.x_node = "xx-sis" if params[:button] == "add"
Severity: Major
Found in app/controllers/ops_controller/settings/analysis_profiles.rb - About 45 mins to fix

Method settings_update_help_menu has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def settings_update_help_menu
    assert_privileges("region_edit")

    return unless load_edit('customize_help_menu')

Severity: Minor
Found in app/controllers/ops_controller/settings/help_menu.rb - About 45 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

Avoid deeply nested control flow statements.
Open

          case schedule.filter.exp[key]["field"]
          when "Vm.ext_management_system-name",
               "MiqTemplate.ext_management_system-name",
               "Storage.ext_management_systems-name",
               "Host.ext_management_system-name",
Severity: Major
Found in app/controllers/ops_controller/settings/schedules.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            @sb[:miq_tab] = @scan.mode == "Host" ? "edit_2" : "edit_1"
Severity: Major
Found in app/controllers/ops_controller/settings/analysis_profiles.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        if @sb[:active_tab] == "diagnostics_evm_log"
          @log = fetch_local_log("evm")
          add_flash(_("Logs for this %{product} Server are not available for viewing") % {:product => Vmdb::Appliance.PRODUCT_NAME}, :warning) if @log.blank?
          @msg_title = _("ManageIQ")
          @refresh_action = "refresh_log"
Severity: Major
Found in app/controllers/ops_controller/diagnostics.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            @scan.mode = params[:typ] if params[:typ]
Severity: Major
Found in app/controllers/ops_controller/settings/analysis_profiles.rb - About 45 mins to fix
Severity
Category
Status
Source
Language