ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

Method settings_analysis_profile_summary has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def settings_analysis_profile_summary(selected_scan, categories, files, file_stats, registry, nteventlog)
Severity: Minor
Found in app/helpers/settings_analysis_profile_helper.rb - About 45 mins to fix

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

  def record_name(rec)
    column   = rec.display_name.blank? ? :name : :display_name
    rec_name = if rec.kind_of?(MiqAeNamespace) && rec.domain?
                 editable_domain?(rec) && rec.enabled ? rec.send(column) : add_read_only_suffix(rec.send(column), editable_domain?(rec), rec.enabled)
               else
Severity: Minor
Found in app/helpers/miq_ae_class_helper.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

      return x_node == "root" ? "miq_report_schedules_center_tb" : "miq_report_schedule_center_tb"
Severity: Major
Found in app/helpers/application_helper/toolbar_chooser.rb - About 45 mins to fix

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

  def center_toolbar_filename_storage
    if x_active_tree == :storage_tree
      if x_node_split.first == 'ds'
        return "storage_center_tb"
      else
Severity: Minor
Found in app/helpers/application_helper/toolbar_chooser.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 def_searches_active_filter? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def def_searches_active_filter?(search)
    if @edit && @edit[:expression] &&
       ((default_search?(search.name) || no_default_search?(search.id)) && expression_selected_nil_or_id(search.id) ||
        (@edit[:expression][:selected] && @edit[:expression][:selected][:id].zero? && search.id.to_i.zero? ||
         expression_selected_id_or_name(:name, search.name)))
Severity: Minor
Found in app/helpers/application_helper.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_summary_alert_send_email has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def miq_summary_alert_send_email(alert, email_to)
    alert_options = alert.options
    if alert_options && alert_options[:notifications] && alert.options[:notifications][:email].present?
      rows = []
      data = {:title => _('Send E-mail'), :mode => "miq_alert_send_email", :rows => []}
Severity: Minor
Found in app/helpers/miq_alert_helper.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

          if @tagging
            return false # when tagging Users, Groups, Roles and Tenants, the table is non-clickable
          else
            return "/" + request.parameters[:controller] + "/tree_select/?id=" + x_node.split("-")[1]
          end
Severity: Major
Found in app/helpers/application_helper.rb - About 45 mins to fix

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

  def process_managers(managers, task)
    controller_class = request.parameters[:controller]
    provider_class = case controller_class
                     when 'ems_automation' then ManageIQ::Providers::AutomationManager
                     when 'ems_configuration'  then ManageIQ::Providers::ConfigurationManager
Severity: Minor
Found in app/controllers/application_controller/ci_processing.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

        elsif view.db == "MiqServer" &&
              %w[ops report].include?(request.parameters[:controller])
          return "/" + request.parameters[:controller] + "/tree_select/?id=" + TREE_WITH_TAB[active_tab]
        elsif %w[ScanItemSet
                 MiqSchedule
Severity: Major
Found in app/helpers/application_helper.rb - About 45 mins to fix

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

  def javascript_for_miq_button_visibility(display, prefix = nil)
    if prefix
      "miqButtons('#{display ? 'show' : 'hide'}', '#{prefix}');".html_safe
    else
      "miqButtons('#{display ? 'show' : 'hide'}');".html_safe
Severity: Minor
Found in app/helpers/application_helper.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 perf_menu_click has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def perf_menu_click
    # Parse the clicked item to get indexes and selection variables
    chart_click_data = parse_chart_click(params[:menu_click])
    # Swap in 'Instances' for 'VMs' in AZ breadcrumbs (poor man's cloud/infra split hack)
    bc_model = %w[availability_zone host_aggregate].include?(request.parameters['controller']) && chart_click_data.model == 'VMs' ? 'Instances' : chart_click_data.model
Severity: Minor
Found in app/controllers/application_controller/performance.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 prov_vm_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def prov_vm_data(data)
    edit = data[:edit]
    clones = [:clone_to_template, :clone_to_vm]
    headers = prov_grid_vm_header(edit, clones, data[:vms], data[:type])
    rows = []
Severity: Minor
Found in app/helpers/request_info_helper.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

          next if @edit[:new][ppid] == @edit[:current][ppid] # Only process changes
Severity: Major
Found in app/controllers/application_controller/policy_support.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

      elsif @edit[:new][:current_tab_key] == :purpose
        build_tags_for_provisioning(@edit[:wf], @edit[:new][:vm_tags], true)
Severity: Major
Found in app/controllers/application_controller/miq_request_methods.rb - About 45 mins to fix

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

  def drift_add_section_field_compressed(view, section, field)
    row = {}
    view.ids.each_with_index do |id, idx|
      fld = view.results.fetch_path(id, section[:name], field[:name])
      val = fld[:_value_].to_s unless fld.nil?
Severity: Minor
Found in app/controllers/application_controller/compare.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 get_timezone_offset has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def get_timezone_offset(user = nil, formatted = false)
      tz = user ? user.get_timezone : server_timezone
      tz = ActiveSupport::TimeZone::MAPPING[tz]
      ActiveSupport::TimeZone.all.each do |a|
        if ActiveSupport::TimeZone::MAPPING[a.name] == tz
Severity: Minor
Found in app/controllers/application_controller/timezone.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

              if params[key] == "__HOST__NONE__" # Added this to deselect datastore in grid
                @edit[:new][f.to_sym] = [nil, nil] # Save [value, description]
              elsif v.id.to_i == val.to_i
                @edit[:new][f.to_sym] = [val, v.name] # Save [value, description]
              end
Severity: Major
Found in app/controllers/application_controller/miq_request_methods.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          cols[i].gsub!(/\*\s/, "") if csv # If generating CSV
Severity: Major
Found in app/controllers/application_controller/compare.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

      @edit[:hide_deprecated_templates] = provisioning_is_cloud? ? params[:hide_deprecated_templates] == "true" : nil
Severity: Major
Found in app/controllers/application_controller/miq_request_methods.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        if @edit[:wf].supports_customization_template?
          build_template_grid(@edit[:wf].send("allowed_customization_templates"), @edit[:template_sortdir], @edit[:template_sortcol])
        else
          build_vc_grid(@edit[:wf].get_field(:sysprep_custom_spec, :customize)[:values], @edit[:vc_sortdir], @edit[:vc_sortcol])
        end
Severity: Major
Found in app/controllers/application_controller/miq_request_methods.rb - About 45 mins to fix
Severity
Category
Status
Source
Language