ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method exp_remove has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

  def exp_remove(exp, token)
    return true if exp[:token] && exp[:token] == token # If the token matches

    # Tell caller to remove me
    keepkey, keepval, deletekey = nil                  # Holders for key, value pair to keep and key to delete
Severity: Minor
Found in app/controllers/application_controller/filter.rb - About 5 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_button_add has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

  def ab_button_add
    assert_privileges("ab_button_new")
    @sb[:active_tab] = "ab_options_tab"
    @resolve = session[:resolve]
    name = @edit[:new][:instance_name].presence || @edit[:new][:other_name]
Severity: Minor
Found in app/controllers/application_controller/buttons.rb - About 5 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 dialog_get_form_vars has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

  def dialog_get_form_vars
    @record = Dialog.find(@edit[:rec_id])

    params.each do |parameter_key, parameter_value|
      parameter_key = parameter_key.split("__protected").first if parameter_key.ends_with?("__protected")
Severity: Minor
Found in app/controllers/application_controller/dialog_runner.rb - About 5 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 settings_update_save has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

  def settings_update_save
    settings_get_form_vars
    return unless @edit

    case @sb[:active_tab]
Severity: Minor
Found in app/controllers/ops_controller/settings/common.rb - About 5 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 build_snmp_options has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    def build_snmp_options(subkey, process_variables)
      refresh = false
      @edit[:new][subkey][:host] = params[:host] if params[:host]         # Actions support a single host in this key
      @edit[:new][subkey][:host][0] = params[:host_1] if params[:host_1]  # Alerts support an array of hosts
      @edit[:new][subkey][:host][1] = params[:host_2] if params[:host_2]
Severity: Minor
Found in app/controllers/mixins/policy_mixin.rb - About 5 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_get_node_info has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

  def widget_get_node_info
    @sb[:nodes] = x_node.split('-')
    if @sb[:nodes].length == 1
      get_all_widgets
      @right_cell_text = _("All Widgets")
Severity: Minor
Found in app/controllers/report_controller/widgets.rb - About 5 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

Class OpsController has 42 methods (exceeds 20 allowed). Consider refactoring.
Open

class OpsController < ApplicationController
  # Methods for accordions
  include Diagnostics
  include OpsRbac
  include Settings
Severity: Minor
Found in app/controllers/ops_controller.rb - About 5 hrs to fix

Class DashboardController has 42 methods (exceeds 20 allowed). Consider refactoring.
Open

class DashboardController < ApplicationController
  include Mixins::BreadcrumbsMixin
  include DashboardHelper
  include Mixins::StartUrl

Severity: Minor
Found in app/controllers/dashboard_controller.rb - About 5 hrs to fix

Function createSchema has 141 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const createSchema = (credentials, credentialReferences, payloadCredentials, workflowAuthentications, setState) => {
  // Saves a new credential mapping to 'credentials'
  const mapCredentials = () => setState((state) => {
    if (state.workflowCredentials && state.credentialField) {
      return ({

Function createSchema has 141 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const createSchema = (credentials, credentialReferences, payloadCredentials, workflowAuthentications, setState) => {
  // Saves a new credential mapping to 'credentials'
  const mapCredentials = () => setState((state) => {
    if (state.workflowCredentials && state.credentialField) {
      return ({

File widgets.rb has 551 lines of code (exceeds 400 allowed). Consider refactoring.
Open

module ReportController::Widgets
  extend ActiveSupport::Concern

  RIGHT_CELL_TEXTS = {
    "r"  => [N_('Report Widgets'),   N_('Report Widget "%{name}"')],
Severity: Major
Found in app/controllers/report_controller/widgets.rb - About 5 hrs to fix

Function provisionTabSchema has 140 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const provisionTabSchema = (
  repositories,
  setData,
  provisionRepositoryId,
  currentRegion,

Method update_from_params has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    def update_from_params(params)
      self.typ         = params[:perf_typ]          if params[:perf_typ]
      self.days        = params[:perf_days]         if params[:perf_days]
      self.rt_minutes  = params[:perf_minutes].to_i if params[:perf_minutes]
      self.hourly_date = params[:miq_date_1]        if params[:miq_date_1] && typ == 'Hourly'
Severity: Minor
Found in app/controllers/application_controller/performance/options.rb - About 5 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 rbac_field_changed has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

  def rbac_field_changed(rec_type)
    id = params[:id].split('__').first || 'new' # Get the record id
    id = id unless %w[new seq].include?(id)
    return unless load_edit("rbac_#{rec_type}_edit__#{id}", "replace_cell__explorer")

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

  def gfv_key_style(key, value)
    parm, f_idx, s_idx = key.split("_") # Get the parm type, field index, and style index
    f_idx = f_idx.to_i
    s_idx = s_idx.to_i
    f = @edit[:new][:field_order][f_idx] # Get the field element
Severity: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 5 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 138 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const createSchema = (fields, edit, ems, loadSchema, emptySchema) => {
  const idx = fields.findIndex((field) => field.name === 'volume_type');
  const supports = edit ? 'supports_cloud_volume' : 'supports_cloud_volume_create';
  let providerCapabilities;

Class MiqRequestController has 41 methods (exceeds 20 allowed). Consider refactoring.
Open

class MiqRequestController < ApplicationController
  include Mixins::GenericSessionMixin
  include Mixins::BreadcrumbsMixin

  before_action :check_privileges, :except => :post_install_callback
Severity: Minor
Found in app/controllers/miq_request_controller.rb - About 5 hrs to fix

Function createSchema has 137 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const createSchema = (state, setState, ems, initialValues, storageId, setStorageId, volumeId, setVolumeId) => {
  let emsId = state.ems_id;
  if (initialValues && initialValues.ems_id) {
    emsId = initialValues.ems_id;
  }

Function MiqDataTable has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

const MiqDataTable = ({
  headers,
  rows,
  onCellClick,
  mode,
Severity: Minor
Found in app/javascript/components/miq-data-table/index.jsx - About 5 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 settings_replace_right_cell has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

  def settings_replace_right_cell(nodetype, presenter)
    case nodetype
    when "ze" # zone edit
      # when editing zone in settings tree
      if @zone.id.blank?
Severity: Minor
Found in app/controllers/ops_controller.rb - About 5 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

Severity
Category
Status
Source
Language