ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,001 of 18,265 total issues

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

  def rbac_user_validate?
    valid = true
    if @edit[:new][:password] != @edit[:new][:verify]
      add_flash(_("Password/Verify Password do not match"), :error)
      valid = false
Severity: Minor
Found in app/controllers/ops_controller/ops_rbac.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 rbac_group_filter_expression_vars has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def rbac_group_filter_expression_vars(field_expression, field_expression_table)
    @edit[:new][field_expression] = if @group&.entitlement && @group.entitlement[field_expression].kind_of?(MiqExpression)
                                      @group.entitlement[field_expression].exp
                                    else
                                      @edit[:new][field_expression] = nil
Severity: Minor
Found in app/controllers/ops_controller/ops_rbac.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 fetch_journal_log has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def fetch_journal_log(service_name = nil, max_count = 1_000, filter_params = {})
    return unless MiqEnvironment::Command.supports_systemd?

    filter_params[:syslog_identifier] = service_name if service_name.present?

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

  def label_tag_mapping_field_changed
    assert_privileges("region_edit")

    return unless load_edit("label_tag_mapping_edit__#{params[:id]}", "replace_cell__explorer")

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

  def edit
    assert_privileges_for_edit
    @_params[:pressed] ||= 'chargeback_rates_edit'

    @_params[:pressed] ||= 'chargeback_rates_edit'
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 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 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 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 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 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 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 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 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 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 playbook_box_edit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def playbook_box_edit
      if params[:inventory_manual] || params[:inventory_localhost] || params[:inventory_event_target]
        update_playbook_variables(params)
      end
      if params[:service_template_id]
Severity: Minor
Found in app/controllers/mixins/playbook_options.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 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