ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

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

Avoid deeply nested control flow statements.
Open

            rescue => bang
              title = params[:button] == "add" ? "add" : "update"
              add_flash(_("Error during '%{title}': %{message}") % {:title => title, :message => bang.message}, :error)
Severity: Major
Found in app/controllers/ops_controller/settings/analysis_profiles.rb - About 45 mins to fix

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

    def set_search_text
      @sb[:pol_search_text] ||= {}
      if params[:search_text]
        @search_text = params[:search_text].strip
        @sb[:pol_search_text][x_active_tree] = @search_text unless @search_text.nil?
Severity: Minor
Found in app/controllers/mixins/policy_mixin.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 custom_toolbar_simple has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def custom_toolbar_simple
    if @record && %w[show show_dashboard].include?(@lastaction) && %w[dashboard main].include?(@display)
      Mixins::CustomButtons::Result.new(:single)
    elsif @lastaction == "show_list" || relationship_table_screen?
      Mixins::CustomButtons::Result.new(:list)
Severity: Minor
Found in app/controllers/mixins/custom_buttons.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 customization_template_edit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def customization_template_edit
    assert_privileges("customization_template_edit")
    unless params[:id]
      obj = find_checked_items
      @_params[:id] = obj[0] unless obj.empty?
Severity: Minor
Found in app/controllers/pxe_controller/pxe_customization_templates.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 reconfigure has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def reconfigure(reconfigure_ids = [])
          @sb[:explorer] = true if @explorer
          @request_id = nil
          @in_a_form = @reconfigure = true
          drop_breadcrumb(:name => _("Reconfigure"), :url => "/vm_common/reconfigure")
Severity: Minor
Found in app/controllers/mixins/actions/vm_actions/reconfigure.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 process_hosts_maintenance has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def process_hosts_maintenance(hosts, display_name)
          each_host(hosts, display_name) do |host|
            if host.maintenance
              if host.supports?(:unset_node_maintenance)
                host.unset_node_maintenance_queue(session[:userid])
Severity: Minor
Found in app/controllers/mixins/actions/host_actions/misc.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 find_checked_items has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def find_checked_items(prefix = nil)
      if params[:miq_grid_checks].present?
        params[:miq_grid_checks].split(",").collect(&:to_i)
      else
        prefix = "check" if prefix.nil?
Severity: Minor
Found in app/controllers/mixins/checked_id_mixin.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