ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method format_cols has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.format_cols(view, row, controller, options)
    cols = []

    state = {"state" => :state_format}
    hardware = {"hardware.bitness" => :hardware_bitness_format}
Severity: Major
Found in lib/gtl_formatter.rb - About 3 hrs to fix

Method report_schedule has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def report_schedule(schedules)
    data = {:title => _('Schedules'), :mode => "miq_report_schedules bordered-list simple_table", :rows => []}
    if schedules.blank?
      data[:message] = _("Report is not Scheduled.")
    else
Severity: Minor
Found in app/helpers/report_helper/report_information_helper.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 center_toolbar_filename_ops has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def center_toolbar_filename_ops
    if x_active_tree == :settings_tree
      if x_node.split('-').last == "msc"
        return "miq_schedules_center_tb"
      elsif x_node.split('-').first == "msc"
Severity: Minor
Found in app/helpers/application_helper/toolbar_chooser.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 calculate_rp_config has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def calculate_rp_config(db_record)
    rp_config = []
    unless db_record.memory_reserve.nil?
      rp_config.push(:field       => _("Memory Reserve"),
                     :description => db_record.memory_reserve)
Severity: Minor
Found in app/helpers/resource_pool_helper.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 ab_group_reorder has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def ab_group_reorder
    assert_privileges("ab_group_reorder")
    case params[:button]
    when "cancel"
      add_flash(_("Button Group Reorder cancelled"))
Severity: Minor
Found in app/controllers/application_controller/buttons.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 fetch_saved_report has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def fetch_saved_report(id)
    rr = MiqReportResult.for_user(current_user).find_by(:id => id)
    if rr.nil? # Saved report no longer exists
      @report = nil
      add_flash(_("Error: Report no longer exists in the database"), :error)
Severity: Minor
Found in app/controllers/chargeback_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

Method reconfigure_handle_submit_button has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

        def reconfigure_handle_submit_button
          options = {:src_ids => params[:objectIds]}
          if params[:cb_memory] == 'true' && role_allows?(:feature => 'vm_reconfigure_memory')
            options[:vm_memory] = params[:memory_type] == "MB" ? params[:memory] : params[:memory].to_i * 1024
          end
Severity: Minor
Found in app/controllers/mixins/actions/vm_actions/reconfigure.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_form_vars has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def get_form_vars
    copy_params_if_present(@edit[:new], params, %i[st_prov_type name description provision_cost catalog_id dialog_id generic_subtype long_description zone_id price retire_fqname reconfigure_fqname fqname])

    @edit[:new][:display] = params[:display] == "1" if params[:display] # @edit[:new][:display] should't be changed if params[:display] is not set
    # saving it in @edit as well, to use it later because prov_set_form_vars resets @edit[:new]
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 gfv_trend has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def gfv_trend
    if params[:chosen_trend_col]
      @edit[:new][:perf_interval] ||= "daily" # Default to Daily
      @edit[:new][:perf_target_pct1] ||= 100  # Default to 100%
      if params[:chosen_trend_col] == "<Choose>"
Severity: Minor
Found in app/controllers/report_controller/reports/editor.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 move_cols_right has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def move_cols_right
    if params[:available_fields].blank? || params[:available_fields][0] == ""
      add_flash(_("No fields were selected to move down"), :error)
    elsif params[:available_fields].length + @edit[:new][:fields].length > MAX_REPORT_COLUMNS
      add_flash(_("Fields not added: Adding the selected %{count} fields will exceed the maximum of %{max} fields") % {:count => params[:available_fields].length + @edit[:new][:fields].length, :max => MAX_REPORT_COLUMNS},
Severity: Minor
Found in app/controllers/report_controller/reports/editor.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_continue has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def prov_continue
    assert_privileges("miq_request_edit")
    if params[:button] == "continue" # Continue the request from the workflow with the new options
      id = params[:id] || "new"
      return unless load_edit("prov_edit__#{id}", "show_list")
Severity: Minor
Found in app/controllers/miq_request_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 format_cols has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def self.format_cols(view, row, controller, options)
    cols = []

    state = {"state" => :state_format}
    hardware = {"hardware.bitness" => :hardware_bitness_format}
Severity: Minor
Found in lib/gtl_formatter.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 createSchema has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createSchema(emsId, parentOptions) {
  const fields = [
    {
      component: componentTypes.SUB_FORM,
      name: 'BasicInformation',
Severity: Major
Found in app/javascript/components/vm-edit-form/vm-edit-form.schema.js - About 3 hrs to fix

Function init has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var init = function() {
    vm.catalogItemModel = {
      name: '',
      description: '',
      long_description: '',

Function getStatusCards has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const getStatusCards = (isLoading, dashboardData) => {
  if (isLoading !== true) {
    return (
      <div>
        <div className="card-wrapper" id="containers">
Severity: Major
Found in app/javascript/components/container-projects/helper.jsx - About 3 hrs to fix

Method build_selected_fields has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def build_selected_fields(rpt)
    fields = []
    headers = {}
    col_formats = {}
    pivot_cols = {}
Severity: Major
Found in app/controllers/report_controller/reports/editor.rb - About 3 hrs to fix

Class ConfigurationController has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

class ConfigurationController < ApplicationController
  include Mixins::StartUrl
  include Mixins::GenericSessionMixin
  include Mixins::BreadcrumbsMixin

Severity: Minor
Found in app/controllers/configuration_controller.rb - About 3 hrs to fix

Class TreeBuilder has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

class TreeBuilder
  include TreeKids

  attr_reader :name, :options, :tree_nodes, :bs_tree

Severity: Minor
Found in app/presenters/tree_builder.rb - About 3 hrs to fix

Method set_form_locals has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def set_form_locals
    locals = {}
    if x_active_tree == :diagnostics_tree
      if @sb[:active_tab] == "diagnostics_cu_repair"
        action_url = "cu_repair"
Severity: Major
Found in app/controllers/ops_controller.rb - About 3 hrs to fix

Method button_set_form_vars has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def button_set_form_vars
    @sb[:buttons_node] = true
    @edit = {}
    if session[:resolve] && session[:resolve][:instance_name]
      @resolve = session[:resolve]
Severity: Major
Found in app/controllers/application_controller/buttons.rb - About 3 hrs to fix
Severity
Category
Status
Source
Language