ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method get_method_form_vars has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def get_method_form_vars
    @ae_method = @edit[:ae_method_id] ? MiqAeMethod.find(@edit[:ae_method_id]) : MiqAeMethod.new
    @in_a_form = true
    if params[:item].blank? && params[:button] != "accept" && params["action"] != "field_delete"
      # for method_inputs view
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr to fix

Method ap_ce_delete has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def ap_ce_delete
    assert_privileges("ap_delete")

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

Severity: Minor
Found in app/controllers/ops_controller/settings/analysis_profiles.rb - About 1 hr to fix

Method schedule_form_field_changed has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def schedule_form_field_changed
    assert_privileges(@edit && @edit[:rpt_id] ? "miq_report_schedule_edit" : "miq_report_schedule_add")

    return unless load_edit("schedule_edit__#{params[:id]}", "replace_cell__explorer")
    schedule_get_form_vars
Severity: Minor
Found in app/controllers/report_controller/schedules.rb - About 1 hr to fix

Method schedule_set_form_vars has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def schedule_set_form_vars
    @timezone_abbr = get_timezone_abbr
    @edit = {}
    @folders = []

Severity: Minor
Found in app/controllers/report_controller/schedules.rb - About 1 hr to fix

Function prepareSubmitData has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

const prepareSubmitData = (values, recId, appliesToClass, appliesToId, initialValues, buttonIcon) => {
  const submitValues = values;
  submitValues.applies_to_class = appliesToClass;
  if (recId) {
    submitValues.applies_to_id = initialValues.applies_to_id;

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

Function createSchema has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

function createSchema(fieldss, recordId, emsId, mode, loadSchema, alertState, alertOptions) {
  let selectedOptions = []; // in edit form, selectedOptions are options that are passed in when open the form for first time
  let editSelectedOptions = []; // in edit form, editSelectedOptions recorded all the selected options once the form is changed
  let selectedOptionsChanged = false; // in edit form, selectedOptionsChanged changes to true once there is a change in selected options

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

Function TimeProfileTable has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

const TimeProfileTable = ({
  initialData,
}) => {
  const { headers, rows } = tableData(initialData);

Severity: Minor
Found in app/javascript/components/data-tables/time-profile-table/index.jsx - About 1 hr 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_link_text has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def build_link_text(args)
      if args.key?(:tables)
        entity_name = ui_lookup(:tables => args[:tables])
        link_text   = args.key?(:link_text) ? "#{args[:link_text]} (#{args[:count]})" : "#{entity_name} (#{args[:count]})"
        title       = _("Show all %{names}") % {:names => entity_name}
Severity: Minor
Found in app/helpers/application_helper/listnav.rb - About 1 hr 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

Function PfAggregateStatusCard has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

const PfAggregateStatusCard = ({
  showTopBorder, altLayout, layout, data,
}) => {
  const shouldShowTopBorder = () => (showTopBorder === true);
  const isAltLayout = () => (altLayout === true || layout === 'tall');
Severity: Minor
Found in app/javascript/components/pf_aggregate_status_card.jsx - About 1 hr 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 center_toolbar_filename_explorer has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def center_toolbar_filename_explorer
    if %w[vm_cloud vm_infra vm_or_template].include?(@layout)
      center_toolbar_name_vm_or_template
    elsif x_active_tree == :ae_tree
      center_toolbar_filename_automate
Severity: Minor
Found in app/helpers/application_helper/toolbar_chooser.rb - About 1 hr 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 process_storage has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def process_storage(storages, task, _ = nil)
    storages, _storages_out_region = filter_ids_in_region(storages, _("Datastore"))
    return if storages.empty?

    if task == "destroy"
Severity: Minor
Found in app/controllers/application_controller/ci_processing.rb - About 1 hr 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 ranges_and_rates has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def ranges_and_rates(num_tiers, tiers, detail, first_tier)
    range_rate = {
      :start => [first_tier.start ? first_tier.start : 0],
      :finish => [first_tier.finish == Float::INFINITY ? _('Infinity') : first_tier.finish],
      :fixed_rate => [first_tier.fixed_rate ? first_tier.fixed_rate : 0.0],
Severity: Minor
Found in app/helpers/chargeback_rate_helper.rb - About 1 hr 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 delete_host_aggregates has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def delete_host_aggregates
    assert_privileges("host_aggregate_delete")

    host_aggregates = checked_or_params

Severity: Minor
Found in app/controllers/host_aggregate_controller.rb - About 1 hr 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 timeline_selected has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def timeline_selected(chart_click_data, data_row, ts)
    @record = find_record_with_rbac(data_row["resource_type"].constantize, data_row["resource_id"])
    return [true, nil] unless @record

    controller = data_row["resource_type"].underscore
Severity: Minor
Found in app/controllers/application_controller/performance.rb - About 1 hr 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 process_datetime_selector has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def process_datetime_selector(params, param_key_suffix, exp_key = nil)
      param_date_key  = "miq_date_#{param_key_suffix}".to_sym
      param_time_key  = "miq_time_#{param_key_suffix}".to_sym
      return unless params[param_date_key] || params[param_time_key]

Severity: Minor
Found in app/controllers/application_controller/filter/expression.rb - About 1 hr 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 explorer has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def explorer
    @explorer = true
    @trees = []
    return if perfmenu_click?

Severity: Minor
Found in app/controllers/ops_controller.rb - About 1 hr 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 button_valid? has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def button_valid?(button_hash = @edit[:new])
    add_flash(_("Button Name is required"), :error) if button_hash[:name].blank? || button_hash[:name].strip.blank?

    if button_hash[:button_icon].blank?
      add_flash(_("Button Icon must be selected"), :error)
Severity: Minor
Found in app/controllers/application_controller/buttons.rb - About 1 hr 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_saveid has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def adv_search_button_saveid
    if @edit[:new_search_name].nil? || @edit[:new_search_name] == ""
      add_flash(_("Search Name is required"), :error) if params[:button] == 'saveit'
      false
    else
Severity: Minor
Found in app/controllers/application_controller/advanced_search.rb - About 1 hr 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 create_instance has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def create_instance
    assert_privileges("miq_ae_instance_new")
    case params[:button]
    when "cancel"
      @sb[:action] = session[:edit] = nil # clean out the saved info
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr 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 schedule_set_record_vars has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def schedule_set_record_vars(schedule)
    schedule.resource_type = schedule_resource_type_from_params_action
    schedule.sched_action = {:method => schedule_method_from_params_action}

    if params[:action_typ] == "automation_request"
Severity: Minor
Found in app/controllers/ops_controller/settings/schedules.rb - About 1 hr 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