ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

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

        def add_security_group_vms
          assert_privileges("instance_add_security_group")
          recs = checked_or_params
          @record = find_record_with_rbac(VmCloud, recs.first)
          if @record.supports?(:add_security_group) && @record.ext_management_system.present?
Severity: Minor
Found in app/controllers/mixins/actions/vm_actions/add_security_group.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 rate_reset_or_set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def rate_reset_or_set
    # TODO: rename chargeback_rates_edit to chargeback_rate_edit
    assert_privileges('chargeback_rates_edit') if params[:button] == "reset"
    @rate = new_rate_edit? ? ChargebackRate.new : ChargebackRate.find(params[:id])
    if params[:pressed] == 'chargeback_rates_edit' && @rate.default?
Severity: Minor
Found in app/controllers/chargeback_rate_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 custom_toolbar_explorer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def custom_toolbar_explorer
    if x_tree
      if @display == "main" && @record
        Mixins::CustomButtons::Result.new(:single)
      elsif @lastaction == "show_list"
Severity: Minor
Found in app/controllers/mixins/custom_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 template_get_form_vars has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def template_get_form_vars
    @ct = @edit[:ct_id] ? CustomizationTemplate.find(@edit[:ct_id]) : CustomizationTemplate.new
    copy_params_if_present(@edit[:new], params, %i[name description typ])
    @edit[:new][:img_type] = params[:img_typ] if params[:img_typ]
    @edit[:new][:script] = params[:script_data] if params[:script_data]
Severity: Minor
Found in app/controllers/pxe_controller/pxe_customization_templates.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 disassociate_floating_ip_vms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def disassociate_floating_ip_vms
          assert_privileges("instance_disassociate_floating_ip")
          recs = checked_or_params
          @record = find_record_with_rbac(VmCloud, recs.first)
          if @record.supports?(:disassociate_floating_ip) && @record.ext_management_system.present?
Severity: Minor
Found in app/controllers/mixins/actions/vm_actions/disassociate_floating_ip.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 polsimvms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def polsimvms
          assert_privileges(params[:pressed])
          records = find_records_with_rbac(VmOrTemplate, checked_or_params)

          if records.empty?
Severity: Minor
Found in app/controllers/mixins/actions/vm_actions/policy_simulation.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 remove_security_group_vms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def remove_security_group_vms
          assert_privileges("instance_remove_security_group")
          recs = checked_or_params
          @record = find_record_with_rbac(VmCloud, recs.first)
          if @record.supports?(:remove_security_group) && @record.ext_management_system.present?
Severity: Minor
Found in app/controllers/mixins/actions/vm_actions/remove_security_group.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 retire has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def retire
          @sb[:explorer] = true if @explorer
          kls = case request.parameters[:controller]
                when "orchestration_stack"
                  OrchestrationStack
Severity: Minor
Found in app/controllers/mixins/actions/vm_actions/retire.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 aws_ebs_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def aws_ebs_options
    options = {}
    options[:volume_type] = params[:volume_type] if params[:volume_type]
    # Only set IOPS if io1 (provisioned IOPS) and IOPS available
    options[:iops] = params[:aws_iops] if options[:volume_type] == 'io1' && params[:aws_iops]
Severity: Minor
Found in app/controllers/cloud_volume_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 header_for_ownership has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def header_for_ownership
          raise _("Items are required for Set Ownership screen") if @ownershipitems.nil? || @ownershipitems.count == 0

          if @ownershipitems.count == 1
            case @ownershipitems.first
Severity: Minor
Found in app/controllers/mixins/actions/vm_actions/ownership.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 associate_floating_ip_vms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def associate_floating_ip_vms
          assert_privileges("instance_associate_floating_ip")
          recs = checked_or_params
          @record = find_record_with_rbac(VmCloud, recs.first)
          if @record.supports?(:associate_floating_ip) && @record.ext_management_system.present?
Severity: Minor
Found in app/controllers/mixins/actions/vm_actions/associate_floating_ip.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 widget_dd_done has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def widget_dd_done
    assert_privileges("dashboard_add")
    if params[:col1] || params[:col2]
      if params[:col1] && params[:col1] != [""]
        @sb[:dashboards][@sb[:active_db]][:col1] = param_widgets(params[:col1])
Severity: Minor
Found in app/controllers/dashboard_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 st_catalog_set_form_vars has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def st_catalog_set_form_vars
    checked = find_checked_items
    checked[0] = params[:id] if checked.blank? && params[:id]

    @record = checked[0] ? find_record_with_rbac(ServiceTemplateCatalog, checked[0]) : ServiceTemplateCatalog.new
Severity: Minor
Found in app/controllers/catalog_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 identify_catalog has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def identify_catalog(id = nil)
    kls = TreeBuilder.get_model_for_prefix(@nodetype) == "MiqTemplate" ? VmOrTemplate : ServiceTemplate
    @record = identify_record(id || params[:id], kls)
    @tenants_tree = build_tenants_tree if kls == ServiceTemplate # Build the tree with available tenants for the Catalog Item/Bundle
    add_flash(_("This item is invalid"), :warning) unless @flash_array || @record.try(:template_valid?)
Severity: Minor
Found in app/controllers/catalog_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 old_dialogs_get_form_vars has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def old_dialogs_get_form_vars
    @dialog = @edit[:dialog]
    @edit[:new][:name] = CGI.unescape(params[:name]) if params[:name]
    @edit[:new][:description] = CGI.unescape(params[:description]) if params[:description]
    @edit[:new][:dialog_type] = CGI.unescape(params[:dialog_type]) if params[:dialog_type]
Severity: Minor
Found in app/controllers/miq_ae_customization_controller/old_dialogs.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 old_dialogs_update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def old_dialogs_update
    assert_privileges(params[:id].present? ? 'old_dialogs_edit' : 'old_dialogs_new')
    id = params[:id] ? params[:id] : "new"
    return unless load_edit("dialog_edit__#{id}", "replace_cell__explorer")
    old_dialogs_update_create
Severity: Minor
Found in app/controllers/miq_ae_customization_controller/old_dialogs.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 params_to_edit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def params_to_edit(cb_assign_key, tag_category_id = nil)
    current_assingments = cb_assign_key == :tags ? @edit[:cb_assign][cb_assign_key].try(:[], tag_category_id) : @edit[:cb_assign][cb_assign_key]

    return unless current_assingments

Severity: Minor
Found in app/controllers/chargeback_assignment_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 hosts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def hosts
      db = params[:db] || controller_name
      db = 'switch' if db == 'infra_networking'
      return unless init_show_variables(db)

Severity: Minor
Found in app/controllers/mixins/explorer_show.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 init_show_variables has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def init_show_variables(db = nil)
      @explorer = true if request.xml_http_request? # Ajax request means in explorer

      @db = db || params[:db] || controller_name

Severity: Minor
Found in app/controllers/mixins/explorer_show.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 open_admin_ui_done has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def open_admin_ui_done
    assert_privileges("ems_infra_admin_ui")
    task = MiqTask.find(params[:task_id])

    if task.results_ready? && task.task_results.kind_of?(String)
Severity: Minor
Found in app/controllers/ems_infra_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