ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Avoid deeply nested control flow statements.
Open

                  template_locals.merge!(fetch_playbook_details) if need_ansible_locals?
Severity: Major
Found in app/controllers/catalog_controller.rb - About 45 mins to fix

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

  def get_sort_col
    unless params[:sortby].nil?
      @sortdir = if @sortcol == params[:sortby].to_i # if same column was selected
                   flip_sort_direction(@sortdir)
                 else
Severity: Minor
Found in app/controllers/application_controller.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

                    g[key] = param_value.to_i * 60 if param_value
Severity: Major
Found in app/controllers/catalog_controller.rb - About 45 mins to fix

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

  def find_filtered(db)
    user     = current_user
    mfilters = user ? user.get_managed_filters : []
    bfilters = user ? user.get_belongsto_filters : []

Severity: Minor
Found in app/controllers/application_controller.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 @edit[:new] && @edit[:new][:dashboard_order]
        action_url = "db_seq_edit"
        locals[:multi_record] = true
      else
        action_url = "db_edit"
Severity: Major
Found in app/controllers/report_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    g[key] = param_value.to_i if param_value
Severity: Major
Found in app/controllers/catalog_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

    elsif x_active_tree == :reports_tree
      action_url = "miq_report_edit"
      record_id = @edit[:rpt_id] ? @edit[:rpt_id] : nil
    elsif x_active_tree == :roles_tree
      action_url = "menu_update"
Severity: Major
Found in app/controllers/report_controller.rb - About 45 mins to fix

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

  def db_widget_remove
    assert_privileges("db_delete")

    return unless load_edit("db_edit__#{params[:id]}", "replace_cell__explorer")
    @dashboard = @edit[:db_id] ? MiqWidgetSet.find(@edit[:db_id]) : MiqWidgetSet.new
Severity: Minor
Found in app/controllers/report_controller/dashboards.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

                  template_locals.merge!(fetch_ct_details) if need_container_template_locals?
Severity: Major
Found in app/controllers/catalog_controller.rb - About 45 mins to fix

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

  def tree_select
    @edit = nil
    @sb[:select_node] = false
    if @sb.key?(:flash_msg)
      @flash_array = @sb[:flash_msg]
Severity: Minor
Found in app/controllers/report_controller.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

            @right_cell_text = @schedule.id ? _("Editing Schedule \"%{name}\"") % {:name => @schedule.name} : _("Adding a new Schedule")
Severity: Major
Found in app/controllers/report_controller.rb - About 45 mins to fix

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

  def get_tree_data
    # build tree for selected role in left div of the right cell
    group_id = x_node(:roles_tree).split('-').last
    session[:role_choice] = MiqGroup.find(group_id).description if group_id.present?
    session[:node_selected] = "" if params[:action] != "menu_field_changed"
Severity: Minor
Found in app/controllers/report_controller/menus.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

                temp.push(el) unless temp.include?(el)
Severity: Major
Found in app/controllers/report_controller/menus.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                temp.push([]) unless temp.include?([])
Severity: Major
Found in app/controllers/report_controller/menus.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                  temp.push([]) unless temp.include?([])
Severity: Major
Found in app/controllers/report_controller/menus.rb - About 45 mins to fix

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

  def delete_cloud_volume_snapshots
    assert_privileges("cloud_volume_snapshot_delete")

    snapshots = find_records_with_rbac(CloudVolumeSnapshot, checked_or_params)
    process_cloud_volume_snapshots(snapshots, "destroy")
Severity: Minor
Found in app/controllers/cloud_volume_snapshot_controller.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 set_attributes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def set_attributes(*attributes, &block)
        attributes.each do |attribute|
          define_method(attribute) do
            result = instance_variable_get("@#{attribute}".to_sym)

Severity: Minor
Found in app/presenters/tree_node/node.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 db_move_cols_up has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def db_move_cols_up
    return unless load_edit("db_edit__seq", "replace_cell__explorer")
    if params[:seq_fields].blank? || params[:seq_fields][0] == ""
      add_flash(_("No fields were selected to move up"), :error)
      @refresh_div = "column_lists"
Severity: Minor
Found in app/controllers/report_controller/dashboards.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 prov_scope has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def prov_scope(opts)
    scope = []
    # Request date (created since X days ago)
    scope << [:created_recently, opts[:time_period].to_i] if opts[:time_period].present?
    # Select requester user across regions
Severity: Minor
Found in app/controllers/miq_request_controller.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 db_fields_validation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def db_fields_validation
    if @edit[:new][:name] && @edit[:new][:name].index('|')
      add_flash(_("Name cannot contain \"|\""), :error)
      return
    end
Severity: Minor
Found in app/controllers/report_controller/dashboards.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