ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method process_textual_info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def process_textual_info(groups, record)
    groups.collect do |big_group|
      big_group.collect do |group_symbol|
        group_result = send("textual_group_#{group_symbol}")
        next if group_result.nil?
Severity: Minor
Found in app/helpers/textual_summary_helper.rb - About 35 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 visible? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def visible?
    # TODO: @feature.nil? || @record.nil? || !@record.kind_of?(Host) || @record.supports?(@feature.to_sym)
    unless @feature.nil? || @record.nil?
      return false if @record.kind_of?(ManageIQ::Providers::Openstack::InfraManager)
      return @record.supports?(@feature.to_sym) if @record.kind_of?(ManageIQ::Providers::Openstack::InfraManager::Host)

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 disabled? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def disabled?
    @error_message = if @record.master_supported?
                       if @record.priority != 1
                         if @view_context.x_node != "root" && @record.server_role.regional_role?
                           _("This role can only be managed at the Region level")
Severity: Minor
Found in app/helpers/application_helper/button/server_promote.rb - About 35 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 cloud_object_store_button_operation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def cloud_object_store_button_operation(klass, task)
    display_name = _(task.capitalize)
    method = "#{klass.name.underscore.to_sym}_#{task}"
    task = method unless task == 'delete'
    items = find_records_with_rbac(klass, checked_or_params)
Severity: Minor
Found in app/controllers/application_controller/ci_processing.rb - About 35 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 gtl_selected_records has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def gtl_selected_records
    records = params.try(:[], :rec_ids) || @edit.try(:[], :pol_items) ||
              @edit.try(:[], :object_ids) || @targets_hash.try(:keys) || @selected_ids

    if records.present?
Severity: Minor
Found in app/helpers/gtl_helper.rb - About 35 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 textual_custom_button_events has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def textual_custom_button_events
    return nil unless User.current_user.super_admin_user? || User.current_user.admin?

    link = if controller.restful?
             polymorphic_path(@record, :display => 'custom_button_events')
Severity: Minor
Found in app/helpers/textual_mixins/textual_custom_button_events.rb - About 35 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 list_view has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def list_view(display, record)
    data = {:mode => "miq_host_#{display}"}
    rows = []
    case display
    when "devices"
Severity: Minor
Found in app/helpers/host_helper.rb - About 35 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 role_allows? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def role_allows?(**options)
    features = Array(options[:feature])

    if features.blank?
      $log.debug("Auth failed - no feature was specified (required)")
Severity: Minor
Found in app/helpers/application_helper.rb - About 35 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_tab_content has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def miq_tab_content(id, active = nil, options = {}, &_block)
    lazy = options[:lazy] && active != id

    classname = %w[tab-pane]
    classname << options[:class] if options[:class]
Severity: Minor
Found in app/helpers/application_helper.rb - About 35 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 textual_storage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def textual_storage
    storages = @record.storages
    h = {:label => _('Datastores'), :icon => "fa fa-database"}
    if storages.empty?
      h[:value] = _("None")
Severity: Minor
Found in app/helpers/vm_helper/textual_summary.rb - About 35 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 compare_build_record_rows has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def compare_build_record_rows(view, section, records, fields)
    records.each_with_index do |record, ridx|
      comp_add_record(view, section, record, ridx)
      unless compare_delete_row
        @rows.pop
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 35 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 comp_record_data_nonexistsmode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def comp_record_data_nonexistsmode(idx, match, value_found, last_value)
    if idx.zero?
      compare_add_txt_col(idx, "%:")
    elsif value_found # This object has the record
      if last_value # Base has the record
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 35 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 tag_edit_build_screen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def tag_edit_build_screen
    @showlinks = true
    @edit[:object_ids] ||= @object_ids

    cats = Classification.categories.select(&:show).sort_by { |t| t.description.try(:downcase) } # Get the categories, sort by description
Severity: Minor
Found in app/controllers/application_controller/tags.rb - About 35 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 quick_search_cancel_click has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def quick_search_cancel_click
    @edit[@expkey][:selected] = @edit[@expkey][:pre_qs_selected]                # Restore previous selected search
    @edit[:adv_search_applied] = @edit[:qs_prev_adv_search_applied]             # Restore previous adv search
    @edit[:adv_search_applied] = nil unless @edit.fetch_path(:adv_search_applied, :exp) # Remove adv search if no prev expression
    self.x_node = @edit[:qs_prev_x_node] if @edit[:in_explorer] && @edit[@expkey][:exp_value] != :user_input # Restore previous exp tree node
Severity: Minor
Found in app/controllers/application_controller/filter.rb - About 35 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 policy_sim_build_screen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def policy_sim_build_screen(records = [])
    @edit ||= {}
    @right_cell_text = _("%{vm_or_template} Policy Simulation") % {:vm_or_template => ui_lookup(:table => vm_or_instance(records.first || session[:tag_items].first))}
    @tagitems = records.presence || session[:tag_items] # Get the db records that are being tagged
    @tagitems = @tagitems.sort_by(&:name)
Severity: Minor
Found in app/controllers/application_controller/policy_support.rb - About 35 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 nested_page? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def nested_page?
    (@display == "repositories" && params[:controller] == "ansible_credential") ||
      (@display == "playbooks" && params[:controller] == "ansible_repository") ||
      (@display == "repositories" && params[:controller] == "workflow_credential") ||
      (@display == "workflows" && params[:controller] == "workflow_repository")
Severity: Minor
Found in app/controllers/application_controller/tags.rb - About 35 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 section_field_compare_values has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def section_field_compare_values(view, section, field, base_val)
    view.ids.each_with_index do |id, idx|
      next if idx.zero? # Not for base object

      fld = view.results.fetch_path(id, section[:name], field[:name])
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 35 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 build_jobs_tab has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def build_jobs_tab
    @pp_choices = PPCHOICES2 # Get special pp choices for jobs/tasks lists
    @settings[:perpage][:job_task] ||= 50 # Default to 50 per page until changed
    @tasks_options = HashWithIndifferentAccess.new if @tasks_options.blank?
    @tasks_options[:zones] = Zone.visible.includes(:miq_servers).collect { |z| z.name if z.miq_servers.present? }.compact
Severity: Minor
Found in app/controllers/miq_task_controller.rb - About 35 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_redraw_left_div has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def adv_search_redraw_left_div
    if @edit[:in_explorer] || %w[storage_tree configuration_scripts_tree].include?(x_active_tree.to_s)
      tree_type = x_active_tree.to_s.sub(/_tree/, '').to_sym
      builder = TreeBuilder.class_for_type(tree_type)
      tree = builder.new(x_active_tree, @sb)
Severity: Minor
Found in app/controllers/application_controller/advanced_search.rb - About 35 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_right_cell_vars has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def set_right_cell_vars
    @sb[:action] = params[:action]
    name = @record.try(:name).to_s
    partial = if ["details"].include?(@showtype)
                "layouts/x_gtl"
Severity: Minor
Found in app/controllers/infra_networking_controller.rb - About 35 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