ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method vm_rename has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def vm_rename
    @record = find_record_with_rbac(VmOrTemplate, params[:miq_grid_checks] || params[:id])
    unless @record.supports?(:rename)
      add_flash(_("Renaming selected VM \"%{name}\" is not supported") % {:name => @record.name}, :error)
      if @explorer
Severity: Minor
Found in app/controllers/vm_common.rb - About 25 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 policies has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def policies
    @vm = @record = identify_record(params[:id], VmOrTemplate)
    @lastaction = "rsop"
    @showtype = "policies"
    drop_breadcrumb(:name => _("Policy Simulation Details for %{name}") % {:name => @record.name},
Severity: Minor
Found in app/controllers/vm_common.rb - About 25 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 button_new_edit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def button_new_edit(typ)
    @record = @custom_button = typ == "new" ? CustomButton.new : CustomButton.find(params[:id])
    @sb[:active_tab] = "ab_options_tab"
    button_set_form_vars
    @in_a_form = true
Severity: Minor
Found in app/controllers/application_controller/buttons.rb - About 25 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 move_cols_bottom has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def move_cols_bottom
    if params[:selected_fields].blank? || params[:selected_fields][0] == ""
      add_flash(_("No fields were selected to move bottom"), :error)
      return
    end
Severity: Minor
Found in app/controllers/application_controller/buttons.rb - About 25 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 adv_search_button_delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def adv_search_button_delete
    s = MiqSearch.find(@edit[@expkey][:selected][:id])
    id = s.id
    sname = s.description
    begin
Severity: Minor
Found in app/controllers/application_controller/advanced_search.rb - About 25 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 scopes_for_role has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def scopes_for_role
    named_scope = []
    named_scope << :not_orphaned unless role_allows?(:feature => 'vm_show_list_orphaned')
    named_scope << :not_archived unless role_allows?(:feature => 'vm_show_list_archived')
    named_scope << :not_retired unless role_allows?(:feature => 'vm_show_list_retired')
Severity: Minor
Found in app/controllers/vm_common.rb - About 25 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 right_cell_text_for_node has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def right_cell_text_for_node(record, model_name)
    if record.try(:id)
      case model_name
      when "CustomButton"
        _("Editing Button \"%{name}\"") % {:name => record.name}
Severity: Minor
Found in app/controllers/miq_ae_customization_controller.rb - About 25 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 edit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def edit
    @record = find_record_with_rbac(VmOrTemplate, params[:id]) # Set the VM object
    
    # reset @explorer if coming from explorer views
    @edit ||= {}
Severity: Minor
Found in app/controllers/vm_common.rb - About 25 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 move_cols_top has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def move_cols_top
    if params[:selected_fields].blank? || params[:selected_fields][0] == ""
      add_flash(_("No fields were selected to move top"), :error)
      return
    end
Severity: Minor
Found in app/controllers/application_controller/buttons.rb - About 25 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 get_node_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_node_info(treenodeid, show_list = true)
    return if params[:cls_id] # no need to do get_node_info if redirected from show_product_update
    @nodetype = valid_active_node(treenodeid).split("-").first
    @show_list = show_list
    if @replace_trees
Severity: Minor
Found in app/controllers/ops_controller.rb - About 25 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 adv_search_button_apply has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def adv_search_button_apply
    @edit[@expkey][:selected] = @edit[@expkey][:exp_last_loaded] # Save the last search loaded (saved)
    @edit[:adv_search_applied] ||= {}
    @edit[:adv_search_applied][:exp] = {}
    adv_search_set_text # Set search text filter suffix
Severity: Minor
Found in app/controllers/application_controller/advanced_search.rb - About 25 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 update_finished has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update_finished
    security_group_id = session[:async][:params][:id]

    td = session[:security_group][:task]
    task = MiqTask.find(td[:id])
Severity: Minor
Found in app/controllers/security_group_controller.rb - About 25 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 fetch_playbook_details has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def fetch_playbook_details(record)
    template_class = get_template_class(record.location)

    options = record.options
    details = {
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 25 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 fields_seq_field_changed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def fields_seq_field_changed
    assert_privileges('miq_ae_field_seq')
    return unless load_edit("fields_edit__seq", "replace_cell__explorer")

    unless handle_up_down_buttons(:fields_list, _('Fields'))
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 25 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 get_method_node_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_method_node_info(node_id)
    begin
      @record = @ae_method = MiqAeMethod.find(node_id)
    rescue ActiveRecord::RecordNotFound
      set_root_node
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 25 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 upload_logos has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def upload_logos(file, field, text, type)
    if field && field[:logo] && field[:logo].respond_to?(:read)
      unless valid_image_file?(field[:logo], type)
        add_flash(_("%{image} must be a .%{type} file") % {:image => text, :type => type}, :error)
      else
Severity: Minor
Found in app/controllers/ops_controller/settings/upload.rb - About 25 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 build_and_add_nodes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def build_and_add_nodes(parents)
    existing_node = find_existing_node(parents)
    return nil if existing_node.nil?

    children = tree_add_child_nodes(existing_node)
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 25 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 add_update_method_add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add_update_method_add
    method = params[:id] != "new" ? find_record_with_rbac(MiqAeMethod, params[:id]) : MiqAeMethod.new
    old_method_attributes = method.attributes.clone

    method.name = params["name"]
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 25 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 priority_form_field_changed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def priority_form_field_changed
    assert_privileges('miq_ae_domain_priority_edit')
    return unless load_edit(params[:id], "replace_cell__explorer")

    @in_a_form = true
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 25 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 edit_domain_or_namespace has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def edit_domain_or_namespace
    obj = find_checked_items
    obj = [x_node] if obj.nil? && params[:id]
    typ = params[:pressed] == "miq_ae_domain_edit" ? MiqAeDomain : MiqAeNamespace
    @ae_ns = find_record_with_rbac(typ, obj[0].split('-')[1])
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 25 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