ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

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

    def rewind(direction)
      case direction
      when 'undo'
        if idx.positive?
          self.idx -= 1
Severity: Minor
Found in app/controllers/application_controller/filter/expression_edit_history.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 adv_search_button has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def adv_search_button
    @edit = session[:edit]
    @view = session[:view]

    # setting default to false
Severity: Minor
Found in app/controllers/application_controller/advanced_search.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

              self.exp_ckey = nil unless MiqExpression.get_col_operators(exp_cfield).include?(exp_ckey)
Severity: Major
Found in app/controllers/application_controller/filter/expression.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        @right_cell_text = if model
                             _("Archived %{models}") % {:models => ui_lookup(:models => model)}
                           else
                             _("Archived VMs & Templates")
                           end
Severity: Major
Found in app/controllers/vm_common.rb - About 45 mins to fix

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

  def replace_right_cell(options = {})
    nodetype, replace_trees = options.values_at(:nodetype, :replace_trees)
    if params[:pressed] == "custom_button"
      presenter = set_custom_button_dialog_presenter(options)
      render :json => presenter.for_render
Severity: Minor
Found in app/controllers/ops_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 valid_resolve_object? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def valid_resolve_object?
    add_flash(_("Starting Class must be selected"), :error) if @resolve[:new][:starting_object].blank?
    if @resolve[:new][:instance_name].blank? && @resolve[:new][:other_name].blank?
      add_flash(_("Starting Process is required"), :error)
    end
Severity: Minor
Found in app/controllers/miq_ae_tools_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

              self.exp_key = nil unless MiqExpression.get_col_operators(:count).include?(exp_key)
Severity: Major
Found in app/controllers/application_controller/filter/expression.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

              self.exp_skey = nil unless MiqExpression.get_col_operators(exp_field).include?(exp_skey)
Severity: Major
Found in app/controllers/application_controller/filter/expression.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

      elsif %w[rbac_role_add rbac_role_copy rbac_role_edit].include?(@sb[:action])
        action_url = "rbac_role_edit"
        record_id = @edit[:role_id] ? @edit[:role_id] : nil
      elsif %w[rbac_group_add rbac_group_edit].include?(@sb[:action])
        action_url = "rbac_group_edit"
Severity: Major
Found in app/controllers/ops_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          elsif params[field_name]
            fld[field] = params[field_name]
Severity: Major
Found in app/controllers/miq_ae_class_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if @report.graph.present?
              @render_chart = true
              @ght_type = "hybrid"
            else
              @ght_type = "tabular"
Severity: Major
Found in app/controllers/chargeback_report_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        record_id = @edit[:user_id] ? @edit[:user_id] : nil
Severity: Major
Found in app/controllers/ops_controller.rb - About 45 mins to fix

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

  def policy_edit_reset
    @policy = params[:id] ? MiqPolicy.find(params[:id]) : MiqPolicy.new # Get existing or new record
    assert_privileges("miq_policy_#{@policy.id ? "edit" : "new"}")
    @in_a_form = true

Severity: Minor
Found in app/controllers/miq_policy_controller/policies.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

            fld[field] = params[field_name] if params[field_name]
Severity: Major
Found in app/controllers/miq_ae_class_controller.rb - About 45 mins to fix

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

  def form_copy_objects_field_changed
    assert_privileges(feature_by_action)
    return unless load_edit("copy_objects__#{params[:id]}", "replace_cell__explorer")

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

  def miq_policy_edit_events
    assert_privileges('miq_policy_events_assignment')
    case params[:button]
    when "cancel"
      @sb[:action] = @edit = nil
Severity: Minor
Found in app/controllers/miq_policy_controller/policies.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 ce_select has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def ce_select
    assert_privileges("region_edit")

    ce_get_form_vars
    if params[:id] == "new"
Severity: Minor
Found in app/controllers/ops_controller/settings/tags.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

            fld[field] = params["fields_password_value_#{i}".to_sym] if params["fields_password_value_#{i}".to_sym]
Severity: Major
Found in app/controllers/miq_ae_class_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        if %w[ap_copy ap_edit ap_host_edit ap_vm_edit].include?(@sb[:action])
          action_url = "ap_edit"
          record_id = @edit[:scan_id] ? @edit[:scan_id] : nil
        elsif %w[schedule_add schedule_edit].include?(@sb[:action])
          action_url = "schedule_edit"
Severity: Major
Found in app/controllers/ops_controller.rb - About 45 mins to fix

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

  def copy_save
    assert_privileges(feature_by_action)
    return unless load_edit("copy_objects__#{params[:id]}", "replace_cell__explorer")

    begin
Severity: Minor
Found in app/controllers/miq_ae_class_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

Severity
Category
Status
Source
Language