ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Function createRows has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

export const createRows = (initialValues, enforced, setEnforced, values, setValues, setDisabled, setChanged, invalid, setInvalid) => {
  /* Determines whether the save button should be disabled
    based on whether the form has changed or if an inputted value is invalid */
  const isDisabled = () => {
    let fresh = true;
Severity: Minor
Found in app/javascript/components/tenant-quota-form/helper.js - About 3 hrs 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 27 (exceeds 5 allowed). Consider refactoring.
Open

  def set_right_cell_vars(options = {})
    name = @record.try(:name).to_s
    table = request.parameters["controller"]
    case @sb[:action]
    when "attach"
Severity: Minor
Found in app/controllers/vm_common.rb - About 3 hrs 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 has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def button
    @edit = session[:edit] # Restore @edit for adv search box

    params[:display] = @display if ["instances"].include?(@display) # Were we displaying vms/hosts/storages
    params[:page] = @current_page if @current_page.nil? # Save current page for list refresh
Severity: Minor
Found in app/controllers/orchestration_stack_controller.rb - About 3 hrs 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 atomic_st_edit has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def atomic_st_edit
    assert_privileges(params[:id] ? 'atomic_catalogitem_edit' : 'atomic_catalogitem_new')

    # reset the active tree back to :sandt_tree, it was changed temporairly to display automate entry point tree in a popup div
    self.x_active_tree = 'sandt_tree'
Severity: Minor
Found in app/controllers/catalog_controller.rb - About 3 hrs 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_form_locals has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def set_form_locals
    locals = {}
    if x_active_tree == :export_tree
      locals[:no_reset] = locals[:no_cancel] = locals[:multi_record] = true
      if x_node == "xx-exportwidgets"
Severity: Minor
Found in app/controllers/report_controller.rb - About 3 hrs 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 dataHelper has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const dataHelper = (values) => {
  const vd = values.description;
  const vt = values.action_type;
  const optionValue = values.options ? values.options : {};
  delete values.action_type;
Severity: Major
Found in app/javascript/components/action-form/helper.js - About 3 hrs to fix

Method settings_get_info has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def settings_get_info(nodetype = x_node)
    nodes = nodetype.downcase.split("-")
    case nodes[0]
    when "root"
      @right_cell_text = _("%{product} Region \"%{name}\"") %
Severity: Major
Found in app/controllers/ops_controller/settings/common.rb - About 3 hrs to fix

File toolbar_chooser.rb has 477 lines of code (exceeds 400 allowed). Consider refactoring.
Open

class ApplicationHelper::ToolbarChooser
  include RestfulControllerMixin

  # Return a blank tb if a placeholder is needed for AJAX explorer screens, return nil if no center toolbar to be shown
  def center_toolbar_filename
Severity: Minor
Found in app/helpers/application_helper/toolbar_chooser.rb - About 3 hrs to fix

Method perf_gen_charts has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def perf_gen_charts(rpt, perf_options, parent = false)
    model_title = parent ? "Parent-#{perf_options[:parent]}" : perf_options[:model]
    charts = []
    chart_data = []
    case perf_options[:typ]
Severity: Major
Found in app/controllers/application_controller/performance.rb - About 3 hrs to fix

Method perf_util_daily_gen_data has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def perf_util_daily_gen_data(_refresh = nil)
    @perf_record ||= @record
    @sb[:summary] = nil # Clear out existing summary report
    @sb[:trend_charts] = nil # Clear out the charts to be generated

Severity: Major
Found in app/controllers/application_controller/performance.rb - About 3 hrs to fix

Method prepare_data_for_compare_or_drift_report has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def prepare_data_for_compare_or_drift_report(mode, csv)
    sb_key = mode == :compare ? :miq_temp_params : :miq_drift_params

    # Collect the data from the @compare object
    @data = []
Severity: Major
Found in app/controllers/application_controller/compare.rb - About 3 hrs to fix

Method button has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def button
    @edit = session[:edit] # Restore @edit for adv search box
    params[:display] = @display if %w[vms storages].include?(@display) # Were we displaying vms/storages

    if params[:pressed].starts_with?("vm_", # Handle buttons from sub-items screen
Severity: Major
Found in app/controllers/host_controller.rb - About 3 hrs to fix

Method pre_prov has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def pre_prov
    assert_privileges("miq_request_edit")
    if params[:button] == "cancel"
      flash_to_session(_("Add of new %{type} Request was cancelled by the user") % {:type => session[:edit][:prov_type]})
      @explorer = session[:edit][:explorer] || false
Severity: Minor
Found in app/controllers/application_controller/miq_request_methods.rb - About 3 hrs 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_edit has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def prov_edit
    assert_privileges("miq_request_edit")
    if params[:button] == "cancel"
      req = MiqRequest.find(session[:edit][:req_id]) if session[:edit] && session[:edit][:req_id]
      flash_to_session(
Severity: Minor
Found in app/controllers/application_controller/miq_request_methods.rb - About 3 hrs 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_field_changed has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def policy_field_changed
    return unless load_edit("miq_policy_edit__#{params[:id]}")

    case @edit[:typ]
    when "events"
Severity: Minor
Found in app/controllers/miq_policy_controller/policies.rb - About 3 hrs 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 action_valid_record? has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def action_valid_record?(rec)
    edit = @edit[:new]
    options = edit[:options]
    add_flash(_("Description is required"), :error) if edit[:description].blank?
    add_flash(_("Action Type must be selected"), :error) if edit[:action_type].blank?
Severity: Minor
Found in app/controllers/miq_action_controller.rb - About 3 hrs 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 send_button_changes has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def send_button_changes
      if @edit
        @changed = (@edit[:new] != @edit[:current])
      elsif @assign
        @changed = (@assign[:new] != @assign[:current])
Severity: Minor
Found in app/controllers/mixins/policy_mixin.rb - About 3 hrs 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_node_info_handle_leaf_node has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def get_node_info_handle_leaf_node(id)
    show_record(id)
    if @record.atomic? && need_prov_dialogs?(@record.prov_type)
      @miq_request = MiqRequest.find_by(:id => @record.service_resources[0].resource_id) if @record.service_resources[0]&.resource_id
      if @miq_request
Severity: Minor
Found in app/controllers/catalog_controller.rb - About 3 hrs 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_edit has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def widget_edit
    assert_privileges("widget_edit")

    case params[:button]
    when "cancel"
Severity: Minor
Found in app/controllers/report_controller/widgets.rb - About 3 hrs 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 db_to_controller has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def db_to_controller(db, action = "show")
    action = "x_show" if @explorer
    case db
    when "ActionSet"
      controller = "miq_action"
Severity: Major
Found in app/helpers/application_helper.rb - About 3 hrs to fix
Severity
Category
Status
Source
Language