ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method index has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    assert_privileges('my_settings_view')
    @breadcrumbs = []
    active_tab = nil
    if role_allows?(:feature => "my_settings_visuals")
Severity: Minor
Found in app/controllers/configuration_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 iso_datastore_list has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def iso_datastore_list
    assert_privileges('iso_datastore_view')
    @lastaction = "iso_datastore_list"
    @force_no_grid_xml   = true
    if params[:ppsetting]                                             # User selected new per page value
Severity: Minor
Found in app/controllers/pxe_controller/iso_datastores.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 specific_buttons has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def specific_buttons(pressed)
    return false unless BUTTON_TO_ACTION_MAPPING.include?(pressed)

    if pressed == "cloud_volume_refresh"
      queue_refresh(controller_to_model)
Severity: Minor
Found in app/controllers/cloud_volume_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 miq_alert_set_assign has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def miq_alert_set_assign
    assert_privileges("miq_alert_set_assign")
    @assign = @sb[:assign]
    @alert_profile = @assign[:alert_profile] if @assign
    case params[:button]
Severity: Minor
Found in app/controllers/miq_alert_set_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 alert_profile_assign_changed has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def alert_profile_assign_changed
    @assign = @sb[:assign]
    @alert_profile = @assign[:alert_profile]

    if params.key?(:chosen_assign_to)
Severity: Minor
Found in app/controllers/miq_alert_set_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 create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    assert_privileges("cloud_volume_new")
    case params[:button]
    when "cancel"
      flash_and_redirect(_("Add of new Cloud Volume was cancelled by the user"))
Severity: Minor
Found in app/controllers/cloud_volume_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 common_st_record_vars has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def common_st_record_vars(st)
    st.name = @edit[:new][:name]
    st.description = @edit[:new][:description]
    st.long_description = @edit[:new][:display] ? @edit[:new][:long_description] : nil
    st.provision_cost = @edit[:new][:provision_cost]
Severity: Minor
Found in app/controllers/catalog_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 authenticate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def authenticate
    @layout = "dashboard"

    unless params[:task_id] # First time thru, check for buttons pressed
      # Handle More and Back buttons (for changing password)
Severity: Minor
Found in app/controllers/dashboard_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 menu_editor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def menu_editor
    assert_privileges("miq_report_menu_editor")

    menu_set_form_vars if %w[explorer tree_select x_history].include?(params[:action])
    @in_a_form = true
Severity: Minor
Found in app/controllers/report_controller/menus.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 set_elements_and_redirect_unauthorized_user has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def set_elements_and_redirect_unauthorized_user
    @nodetype, _id = parse_nodetype_and_id(params[:id])
    prefix = prefix_by_nodetype(@nodetype)

    # Position in tree that matches selected record
Severity: Minor
Found in app/controllers/vm_cloud_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 delete_cloud_tenants has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def delete_cloud_tenants
    assert_privileges("cloud_tenant_delete")
    tenants = find_records_with_rbac(CloudTenant, checked_or_params)
    tenants_to_delete = []
    tenants.each do |tenant|
Severity: Minor
Found in app/controllers/cloud_tenant_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 db_move_cols_down has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def db_move_cols_down
    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 down"), :error)
      @refresh_div = "column_lists"
Severity: Minor
Found in app/controllers/report_controller/dashboards.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 x_get_tree_aset_kids has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def x_get_tree_aset_kids(object, count_only)
    if object.id.nil?
      get_tree_aset_kids_for_nil_id(object, count_only)
    elsif count_only
      object.members.count
Severity: Minor
Found in app/presenters/custom_buttons_mixin.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 show_schedule has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def show_schedule
    if @schedule.nil?
      flash_to_session
      redirect_to(:action => 'schedules')
      return
Severity: Minor
Found in app/controllers/report_controller/schedules.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

Function miqGrid has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  $.fn.miqGrid = function() {
    var table = $(this);
    var checkall = table.find('thead > tr > th > input.checkall');
    var checkboxes = table.find("tbody > tr > td > input[type='checkbox']");

Severity: Minor
Found in app/javascript/oldjs/miq_grid.js - About 1 hr to fix

Function link has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    link: function(scope, elem, attr, ctrl) {
      elem.datetimepicker({showClear: true, showClose: true});

      // datetime picker uses its own event for change
      elem.on('dp.change', function(event) {
Severity: Minor
Found in app/javascript/oldjs/directives/datetimepicker.js - About 1 hr to fix

Function miqCheckForChanges has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.miqCheckForChanges = function() {
  let type = 'old'; // 'old' | 'angular' | 'tagging' | 'react'
  let dirty = false;
  const ignore = miqDomElementExists('ignore_form_changes');

Severity: Minor
Found in app/javascript/oldjs/miq_application.js - About 1 hr to fix

Method center_toolbar_filename_report has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def center_toolbar_filename_report
    if x_active_tree == :db_tree
      node = x_node
      if %w[root xx-g].include?(node)
        return nil
Severity: Minor
Found in app/helpers/application_helper/toolbar_chooser.rb - About 1 hr to fix

Method miq_catalog_resource has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def miq_catalog_resource(resources)
    headers = ["", _("Name"), _("Description"), _("Action Order"), _("Provision Order"), _("Action Start"), _("Action Stop"), _("Delay (mins) Start"), _("Delay (mins) Stop")]
    data = {:rows => [], :headers => headers}
    prev_group = 0
    resources.sort_by { |rsc| [rsc.group_idx, rsc.resource_name.downcase] }.each_with_index do |r, i|
Severity: Minor
Found in app/helpers/catalog_helper.rb - About 1 hr to fix

Method remove_host has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def remove_host
    assert_privileges("host_aggregate_remove_host")
    @host_aggregate = find_record_with_rbac(HostAggregate, params[:id])

    case params[:button]
Severity: Minor
Found in app/controllers/host_aggregate_controller.rb - About 1 hr to fix
Severity
Category
Status
Source
Language