ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

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

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

  def move_cols_up
    return unless load_edit("rbac_group_edit__seq", "replace_cell__explorer")

    if params[:seq_fields].blank? || params[:seq_fields][0] == ""
      add_flash(_("No fields were selected to move up"), :error)
Severity: Minor
Found in app/controllers/ops_controller/ops_rbac.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

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

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

  def schedule_show
    assert_privileges("schedule")

    @display = "main"
    return if record_no_longer_exists?(@selected_schedule)
Severity: Minor
Found in app/controllers/ops_controller/settings/schedules.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 cu_repair_field_changed has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def cu_repair_field_changed
    assert_privileges("ops_diagnostics")

    return unless load_edit("curepair_edit__new", "replace_cell__explorer")

Severity: Minor
Found in app/controllers/ops_controller/diagnostics.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

            if params[:button] == "save"
              AuditEvent.success(build_saved_audit(scanitemset, @edit))
            else
              AuditEvent.success(build_created_audit(scanitemset, @edit))
            end
Severity: Major
Found in app/controllers/ops_controller/settings/analysis_profiles.rb - About 45 mins to fix

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

  def settings_set_form_vars_authentication
    @edit = {}
    @edit[:new] = {}
    @edit[:current] = {}
    @edit[:key] = "#{@sb[:active_tab]}_edit__#{@sb[:selected_server_id]}"
Severity: Minor
Found in app/controllers/ops_controller/settings/common.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 schedule_toggle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def schedule_toggle(enable)
    msg = if enable
            _("The selected Schedules were enabled")
          else
            _("The selected Schedules were disabled")
Severity: Minor
Found in app/controllers/ops_controller/settings/schedules.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[:selected_server_id] == my_server.id || @selected_server.started?
        if @sb[:active_tab] == "diagnostics_workers"
          pm_get_workers
          @record = @selected_server
        else
Severity: Major
Found in app/controllers/ops_controller/diagnostics.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if @scan.read_only
              add_flash(_("Sample Analysis Profile \"%{name}\" can not be edited") % {:name => @scan.name}, :error)
              get_node_info(x_node)
              replace_right_cell(:nodetype => @nodetype)
              return
Severity: Major
Found in app/controllers/ops_controller/settings/analysis_profiles.rb - About 45 mins to fix

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

  def forest_get_form_vars
    @edit = session[:edit]
    @ldap_info = {}
    @ldap_info[:mode] = params[:user_proxies_mode] if params[:user_proxies] && params[:user_proxies_mode]
    @ldap_info[:ldaphost] = params[:user_proxies][:ldaphost] if params[:user_proxies] && params[:user_proxies][:ldaphost]
Severity: Minor
Found in app/controllers/ops_controller/settings.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 rbac_build_list has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def rbac_build_list(rec_type)
    @lastaction = "rbac_#{rec_type}s_list"
    @force_no_grid_xml = true
    if params[:ppsetting]                                             # User selected new per page value
      @items_per_page = params[:ppsetting].to_i                       # Set the new per page value
Severity: Minor
Found in app/controllers/ops_controller/ops_rbac.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 schedule_validate? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def schedule_validate?(sched)
    valid = true
    unless %w[automation_request].include?(params[:action_typ])
      if %w[global my].include?(params[:filter_typ])
        if params[:filter_value].blank? # Check for search filter chosen
Severity: Minor
Found in app/controllers/ops_controller/settings/schedules.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 rbac_group_right_tree has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def rbac_group_right_tree(selected_nodes)
    case @sb[:active_rbac_group_tab]
    when 'rbac_customer_tags'
      cats = Classification.categories.select do |c|
        c.show || !%w[folder_path_blue folder_path_yellow].include?(c.name) && !(c.read_only? || c.entries.empty?)
Severity: Minor
Found in app/controllers/ops_controller/ops_rbac.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

Severity
Category
Status
Source
Language