ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method qs_show_user_input_checkbox? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def qs_show_user_input_checkbox?
    return true if @edit[:expression_method]
    return false unless @edit[:adv_search_open] # Only allow user input for advanced searches
    return false unless QS_VALID_USER_INPUT_OPERATORS.include?(@edit[@expkey][:exp_key])
    val = (@edit[@expkey][:exp_typ] == "field" && # Field atoms with certain field types return true
Severity: Minor
Found in app/helpers/application_helper.rb - About 1 hr 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 prov_vm_grid_cells has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def prov_vm_grid_cells(data, edit)
    cells = [
      prov_cell_data(data.name),
      prov_cell_data(data.operating_system.try(:product_name)),
      prov_cell_data(data.platform),
Severity: Minor
Found in app/helpers/request_info_helper.rb - About 1 hr 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 perf_gen_top_data_after_wait has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def perf_gen_top_data_after_wait
    miq_task = MiqTask.find(params[:task_id]) # Not first time, read the task record
    if miq_task.task_results.kind_of?(Array)
      rpts = miq_task.task_results.reverse # Grab the array of report objects (reversed so reports can be popped off)
    else
Severity: Minor
Found in app/controllers/application_controller/performance.rb - About 1 hr 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 policy_sim has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def policy_sim(records = [])
    # prevent adv_search_build on policy_sim screens
    @in_a_form = true

    if request.xml_http_request? # Ajax request means in explorer
Severity: Minor
Found in app/controllers/application_controller/policy_support.rb - About 1 hr 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 load_default_search has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def load_default_search(id)
    @edit ||= {}
    @expkey = :expression                                                     # Reset to use default expression key
    @edit[@expkey] ||= Expression.new
    @edit[@expkey][:expression] = []                                          # Store exps in an array
Severity: Minor
Found in app/controllers/application_controller/filter.rb - About 1 hr 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 exp_remove_cmd has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def exp_remove_cmd
    remove_top = exp_remove(@edit[@expkey][:expression], @edit[@expkey][:exp_token])
    if remove_top == true
      exp = @edit[@expkey][:expression]
      if exp["not"]                                       # If the top expression is a NOT
Severity: Minor
Found in app/controllers/application_controller/filter.rb - About 1 hr 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 comp_add_section_field_expanded has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def comp_add_section_field_expanded(view, section, field)
    row = {}
    base_val = view.results.fetch_path(view.ids[0], section[:name], field[:name], :_value_)
    view.ids.each_with_index do |id, idx|
      fld = view.results.fetch_path(id, section[:name], field[:name])
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 1 hr 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 drift_section_data_cols has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def drift_section_data_cols(view, section)
    row = {}
    view.ids.each_with_index do |id, idx|
      if idx.zero?
        row.merge!(drift_add_same_image(idx, _("Starting values")))
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 1 hr 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 exp_changed has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def exp_changed
    @edit = session[:edit]
    @edit[@expkey].update_from_expression_editor(params)
    # See if only a text value changed
    if params[:chosen_value] || params[:chosen_regkey] || params[:chosen_regval] ||
Severity: Minor
Found in app/controllers/application_controller/filter.rb - About 1 hr 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 tl_build_timeline_report_options has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def tl_build_timeline_report_options
    if !@tl_options.date.start.nil? && !@tl_options.date.end.nil?
      tl_type = @tl_options.management_events? ? "events" : "policy_events"
      tl_granularity = case @tl_options.date.typ
                       when "Hourly" then "hourly"
Severity: Minor
Found in app/controllers/application_controller/timelines.rb - About 1 hr 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 drift_add_section_field_expanded has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def drift_add_section_field_expanded(view, section, field)
    row = {:col0 => field[:header]}
    view.ids.each_with_index do |id, idx|
      fld = view.results.fetch_path(id, section[:name], field[:name])
      next if fld.nil?
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 1 hr 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 resolve_button_reset_or_none has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def resolve_button_reset_or_none
    if params[:simulate] == "simulate"
      @resolve = session[:resolve]
      @resolve[:ae_result] = nil
    else
Severity: Minor
Found in app/controllers/application_controller/automate.rb - About 1 hr 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 exp_remove_tokens has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def exp_remove_tokens(exp)
    if exp.kind_of?(Array)      # Is this and AND or OR
      exp.each do |e|           #   yes, check each array item
        exp_remove_tokens(e)    # Remove tokens from children
      end
Severity: Minor
Found in app/controllers/application_controller/filter.rb - About 1 hr 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 listnav_search_selected has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def listnav_search_selected(id = nil)
    id ||= params[:id]
    @edit = session[:edit]
    @edit[:selected] = true # Set a flag, this is checked whether to load initial default or clear was clicked
    if id.to_i.zero?
Severity: Minor
Found in app/controllers/application_controller/filter.rb - About 1 hr 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 drift_record_existmode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def drift_record_existmode(idx, value_found, last_value)
    text = value_found ? _("Found") : _("Missing")
    if value_found # This object has the record
      if last_value # Base has the record
        img_bkg = ''
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 1 hr 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 group_button_add_save has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def group_button_add_save(typ)
    assert_privileges(params[:button] == "add" ? "ab_group_new" : "ab_group_edit")
    if typ == "update"
      update_page_content("saved")
    else
Severity: Minor
Found in app/controllers/application_controller/buttons.rb - About 1 hr 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 playbook_inputs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def playbook_inputs(method)
    existing_inputs = method.inputs
    new_inputs = params[:extra_vars] || []
    inputs_to_save = []
    inputs_to_delete = []
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr 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_edit has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def fields_seq_edit
    assert_privileges("miq_ae_field_seq")
    case params[:button]
    when "cancel"
      @sb[:action] = session[:edit] = nil # clean out the saved info
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr 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_fields has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def update_fields
    assert_privileges('miq_ae_field_edit')
    return unless load_edit("aefields_edit__#{params[:id]}", "replace_cell__explorer")

    fields_get_form_vars
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr 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_form_vars has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def get_form_vars
    @ae_class = MiqAeClass.find_by(:id => @edit[:ae_class_id])
    # for class add tab
    @edit[:new][:name] = params[:name].presence if params[:name]
    @edit[:new][:description] = params[:description].presence if params[:description]
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr 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