ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method schedule_get_form_vars has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def schedule_get_form_vars
    @schedule = @edit[:sched_id] ? MiqSchedule.find(@edit[:sched_id]) : MiqSchedule.new(:userid => session[:userid])
    copy_params_if_present(@edit[:new], params, %i[name description])
    @edit[:new][:enabled] = (params[:enabled] == "1") if params[:enabled]
    @edit[:new][:filter] = params[:filter_typ] if params[:filter_typ]
Severity: Major
Found in app/controllers/report_controller/schedules.rb - About 2 hrs to fix

Method for_render_default has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def for_render_default
    data = {:explorer => 'replace_right_cell', :scrollTop => true}

    if @options[:exp].present?
      data.store_path(:expEditor, :first, :type,   @options[:exp][:val1_type]) if @options[:exp][:val1_type]
Severity: Major
Found in app/presenters/explorer_presenter.rb - About 2 hrs to fix

Method vm_vendor_details has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def vm_vendor_details
    {:vendor_display => _("Vendor"), :format => _("Format"), :version => _("Version"),
     :annotation => _("Notes")}.map do |method, title|
      if method == :annotation
        if @record.hardware
Severity: Minor
Found in app/helpers/textual_mixins/textual_vmm_info.rb - About 2 hrs 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_data_before_wait has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def perf_gen_data_before_wait
    interval_type = @perf_options[:typ].downcase
    case interval_type
    when "hourly", "daily"

Severity: Minor
Found in app/controllers/application_controller/performance.rb - About 2 hrs 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_objects has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def process_objects(objs, task, display_name = nil)
    klass = record_class
    klass_str = klass.to_s

    assert_rbac(klass, objs)
Severity: Minor
Found in app/controllers/application_controller/ci_processing.rb - About 2 hrs 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_elements has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def process_elements(elements, klass, task, display_name = nil, order_field = nil)
    order_field ||= %w[name description title].find { |field| klass.column_names.include?(field) }

    order_by = order_field == "ems_id" ? order_field : klass.arel_table[order_field].lower

Severity: Minor
Found in app/controllers/application_controller/ci_processing.rb - About 2 hrs 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 assigned_filters has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def assigned_filters
    assigned_filters = []
    # adding assigned filters for a user into hash to display categories bold and gray out subcategory if checked
    @get_filters = [current_user.get_managed_filters].flatten
    h = Hash[*@get_filters.collect { |v| [@get_filters.index(v), v] }.flatten]
Severity: Minor
Found in app/controllers/application_controller/policy_support.rb - About 2 hrs 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 format_data_in_section has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def format_data_in_section(section, method)
    @compare.results.each do |vm|
      vm[1][section.to_sym].each do |s|
        @compare.master_list.each_slice(3) do |sections, records, _fields| # section is a symbol, records and fields are arrays
          next unless sections[:name].to_s == section.to_s
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 2 hrs 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 change_tab has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def change_tab(new_tab_id = nil)
    assert_privileges(x_active_tree == :settings_tree ? "ops_settings" : "ops_diagnostics")

    @explorer = true
    params[:miq_grid_checks] = []
Severity: Minor
Found in app/controllers/ops_controller.rb - About 2 hrs 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 18 (exceeds 5 allowed). Consider refactoring.
Open

  def get_node_info(treenodeid, show_list = true)
    # resetting action that was stored during edit to determine what is being edited
    @sb[:action] = nil

    @nodetype, node_id =
Severity: Minor
Found in app/controllers/vm_common.rb - About 2 hrs 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 replace_right_cell has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def replace_right_cell(options = {})
    action, presenter = options.values_at(:action, :presenter)
    @explorer = true
    @sb[:action] = action unless action.nil?
    if @sb[:action] || params[:display]
Severity: Minor
Found in app/controllers/infra_networking_controller.rb - About 2 hrs 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 handle_bottom_cell has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def handle_bottom_cell(presenter)
    if allowed(@sb[:action]) && (@pages || @in_a_form)
      if @pages
        presenter.hide(:form_buttons_div)
      elsif @in_a_form && @sb[:action]
Severity: Minor
Found in app/controllers/miq_ae_customization_controller.rb - About 2 hrs 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_search has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def build_search(name_given_by_user, global_search, userid)
      if selected.nil? ||                                # if no search was loaded
         name_given_by_user != selected[:description] || # or user changed the name of loaded search
         selected[:typ] == 'default'                     # or loaded search is default search, save it as my search
        s = build_new_search(name_given_by_user)
Severity: Minor
Found in app/controllers/application_controller/filter/expression.rb - About 2 hrs 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 has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    assert_privileges("security_group_edit")
    @security_group = find_record_with_rbac(SecurityGroup, params[:id])

    case params[:button]
Severity: Minor
Found in app/controllers/security_group_controller.rb - About 2 hrs 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 action_build_edit_screen has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def action_build_edit_screen
    @edit = {}
    @edit[:new] = {}
    @edit[:current] = {}

Severity: Minor
Found in app/controllers/miq_action_controller.rb - About 2 hrs 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 rate_save_add has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def rate_save_add
    # TODO: rename chargeback_rates_edit and chargeback_rates_new to chargeback_rate_edit and chargeback_rate_new
    assert_privileges(params[:id] ? 'chargeback_rates_edit' : 'chargeback_rates_new')
    id = params[:button] == "save" ? params[:id] : "new"
    return unless load_edit("cbrate_edit__#{id}")
Severity: Minor
Found in app/controllers/chargeback_rate_controller.rb - About 2 hrs 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 default_entry_point has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def default_entry_point(prov_type, service_type)
    klass = class_service_template(prov_type)
    ENTRY_POINT_TYPES.each do |key, _prefix|
      fields            = entry_point_fields(key)
      type              = fields[:type]
Severity: Minor
Found in app/controllers/catalog_controller.rb - About 2 hrs 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 form_field_changed has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def form_field_changed
    assert_privileges(session.fetch_path(:edit, :rpt_id) ? "miq_report_edit" : "miq_report_new")

    return unless load_edit("report_edit__#{params[:id]}", "replace_cell__explorer")
    get_form_vars
Severity: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 2 hrs 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_left_right has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def move_cols_left_right(direction)
    flds = direction == "right" ? "available_fields" : "selected_fields"
    edit_fields = direction == "right" ? "available_fields" : "fields"
    sort_fields = direction == "right" ? "fields" : "available_fields"
    if params[flds.to_sym].blank? || params[flds.to_sym][0] == ""
Severity: Minor
Found in app/controllers/application_controller.rb - About 2 hrs 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_menu_cols_right has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def move_menu_cols_right
    if params[:selected_reports].blank? || params[:selected_reports][0] == ""
      add_flash(_("No fields were selected to move right"), :error)
      return
    end
Severity: Minor
Found in app/controllers/report_controller/menus.rb - About 2 hrs 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