ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,001 of 18,265 total issues

Method prov_field_changed has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

  def prov_field_changed
    assert_privileges("miq_request_edit")

    if params[:tab_id]
      @edit = session[:edit]
Severity: Minor
Found in app/controllers/application_controller/miq_request_methods.rb - About 6 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 buttons_get_node_info has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

  def buttons_get_node_info(node)
    nodetype = node.split("_")
    # initializing variables to hold data for selected node
    @custom_button = nil
    @sb[:button_groups] = nil
Severity: Minor
Found in app/controllers/application_controller/buttons.rb - About 6 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 miq_report_edit has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

  def miq_report_edit
    assert_privileges(params[:id] || (@edit && @edit[:rpt_id]) ? "miq_report_edit" : "miq_report_new")
    case params[:button]
    when "cancel"
      if @edit[:rpt_id]
Severity: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 6 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_form_vars has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

  def widget_get_form_vars
    @widget = @edit[:widget_id] ? MiqWidget.find(@edit[:widget_id]) : MiqWidget.new

    copy_params_if_set(@edit[:new], params, %i[title description])
    @edit[:new][:filter]  = params[:filter_typ]       if params[:filter_typ]
Severity: Minor
Found in app/controllers/report_controller/widgets.rb - About 6 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

File miq_formatters.spec.js has 583 lines of code (exceeds 400 allowed). Consider refactoring.
Open

require('../helpers/miq_formatters_helper.js');

describe('ManageIQ.charts.formatters', () => {
  describe('curried/uncurried', () => {
    var options = {
Severity: Major
Found in app/javascript/spec/old_js/miq_formatters.spec.js - About 6 hrs to fix

Method set_record_vars has 159 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def set_record_vars(rpt)
    # Set the simple string/number fields
    rpt.template_type = "report"
    rpt.name          = @edit[:new][:name].to_s.strip
    rpt.title         = @edit[:new][:title].to_s.strip
Severity: Major
Found in app/controllers/report_controller/reports/editor.rb - About 6 hrs to fix

Class StorageController has 46 methods (exceeds 20 allowed). Consider refactoring.
Open

class StorageController < ApplicationController
  include StorageD
  include StoragePod
  include Mixins::GenericSessionMixin
  include Mixins::GenericShowMixin
Severity: Minor
Found in app/controllers/storage_controller.rb - About 6 hrs to fix

File schema.js has 578 lines of code (exceeds 400 allowed). Consider refactoring.
Open

import { componentTypes, validatorTypes } from '@@ddf';
import {
  loadPlayBookOptions,
  transformObjectToSelectOptions,
  transformCurrenciesOptions,

Method automate_button_field_changed has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

  def automate_button_field_changed
    assert_privileges(feature_by_action)

    unless params[:target_class]
      @edit = session[:edit]
Severity: Minor
Found in app/controllers/application_controller/buttons.rb - About 6 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 exp_commit_find has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

  def exp_commit_find(exp)
    if @edit[@expkey][:exp_field].nil?
      add_flash(_("A find field must be chosen to commit this expression element"), :error)
    elsif %w[checkall checkany].include?(@edit[@expkey][:exp_check]) &&
          @edit[@expkey][:exp_cfield].nil?
Severity: Minor
Found in app/controllers/application_controller/filter.rb - About 6 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_reconfigure_hash has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

        def build_reconfigure_hash(reconfigure_ids)
          @req = nil
          @reconfig_values = {}
          if @request_id == 'new'
            @reconfig_values = get_reconfig_info(reconfigure_ids)
Severity: Minor
Found in app/controllers/mixins/actions/vm_actions/reconfigure.rb - About 6 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

File menus.rb has 574 lines of code (exceeds 400 allowed). Consider refactoring.
Open

module ReportController::Menus
  extend ActiveSupport::Concern

  def get_tree_data
    # build tree for selected role in left div of the right cell
Severity: Major
Found in app/controllers/report_controller/menus.rb - About 6 hrs to fix

Class InfraNetworkingController has 45 methods (exceeds 20 allowed). Consider refactoring.
Open

class InfraNetworkingController < ApplicationController
  before_action :check_privileges
  before_action :get_session_data

  after_action :cleanup_action
Severity: Minor
Found in app/controllers/infra_networking_controller.rb - About 6 hrs to fix

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

const createSchema = (edit, ems, initialValues, state, setState, familyId, setFamilyId) => {
  let emsId = state.ems_id;
  let providerCapabilities;
  if (initialValues && initialValues.ems_id) {
    emsId = initialValues.ems_id;

Method protect has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

  def protect
    @display  = nil
    @edit     = session[:edit]

    if params[:check] # Item was checked/unchecked
Severity: Minor
Found in app/controllers/application_controller/policy_support.rb - About 6 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 replace_right_cell has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

  def replace_right_cell(options = {})
    nodetype, replace_trees = options.values_at(:nodetype, :replace_trees)
    replace_trees = @replace_trees if @replace_trees # get_node_info might set this
    # FIXME

Severity: Minor
Found in app/controllers/pxe_controller.rb - About 6 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_get_form_vars has 149 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def settings_get_form_vars
    settings_load_edit
    return unless @edit

    @in_a_form = true
Severity: Major
Found in app/controllers/ops_controller/settings/common.rb - About 5 hrs to fix

Method replace_right_cell has 148 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def replace_right_cell(options = {})
    if params[:action] == 'x_history'
      # Making selected checkboxes array empty when compare cancel is clicked
      params[:miq_grid_checks] = []
    end
Severity: Major
Found in app/controllers/vm_common.rb - About 5 hrs to fix

Function ReconfigureVmForm has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

const ReconfigureVmForm = ({
  recordId, requestId, roles, options, memory,
}) => {
  const [data, setData] = useState({
    initialValues: {},
Severity: Minor
Found in app/javascript/components/reconfigure-vm-form/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 perf_chart_chooser has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

  def perf_chart_chooser
    assert_privileges("perf_reload")
    @record = identify_tl_or_perf_record
    @perf_record = @record.kind_of?(MiqServer) ? @record.vm : @record # Use related server vm record

Severity: Minor
Found in app/controllers/application_controller/performance.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