ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method alert_valid_record? has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def alert_valid_record?(alert)
    if alert.expression.nil?
      add_flash(_("A valid expression must be present"), :error)
    end
    unless display_driving_event?
Severity: Major
Found in app/controllers/miq_alert_controller.rb - About 3 hrs to fix

Method miq_summary_action_type has 92 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def miq_summary_action_type(record, alert_guids, cats)
    record_options = record.options
    data = {:mode => "miq_action_type", :rows => [], :title => ""}
    rows = []
    case record.action_type
Severity: Major
Found in app/helpers/miq_action_helper.rb - About 3 hrs to fix

Class ServiceController has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

class ServiceController < ApplicationController
  include Mixins::GenericSessionMixin
  include Mixins::GenericShowMixin
  include Mixins::GenericListMixin
  include Mixins::BreadcrumbsMixin
Severity: Minor
Found in app/controllers/service_controller.rb - About 3 hrs to fix

Function render has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const {
      data, dialogClassName, hideModal,
    } = this.props;
    const { show } = this.props;
Severity: Major
Found in app/javascript/components/miq-about-modal/miq-about-modal.jsx - About 3 hrs to fix

File infra_networking_controller.rb has 466 lines of code (exceeds 400 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 3 hrs to fix

Method build_automate_tree has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def build_automate_tree(type)
    tree_name = "#{type}_tree".to_sym

    # build the ae tree to show the tree select box for entry point
    if x_active_tree == tree_name && @edit && @edit[:new][:fqname]
Severity: Minor
Found in app/helpers/automate_tree_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 prefill_val_types has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def prefill_val_types
      self.val1 ||= {}
      self.val2 ||= {}
      val1[:type] = case exp_typ
                    when 'field'
Severity: Minor
Found in app/controllers/application_controller/filter/expression.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 replace_right_cell has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def replace_right_cell(options = {})
    @explorer = true
    replace_trees = options[:replace_trees]

    # FIXME: is the following line needed?
Severity: Minor
Found in app/controllers/miq_ae_class_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 timeprofile_set_days_hours has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def timeprofile_set_days_hours(_timeprofile = @timeprofile)
    @timeprofile_details = {}
    @timeprofiles.each do |timeprofile|
      @timeprofile_details[timeprofile.description] = {}
      profile_key = timeprofile.profile[:days].nil? ? "days" : :days
Severity: Minor
Found in app/controllers/configuration_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 build_schedule_options_for_select has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def build_schedule_options_for_select
    @action_type_options_for_select = [
      [_("VM Analysis"), "vm"],
      [_("Template Analysis"), "miq_template"],
      [_("Host Analysis"), "host"],
Severity: Minor
Found in app/controllers/ops_controller/settings/schedules.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 rbac_user_delete has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def rbac_user_delete
    assert_privileges("rbac_user_delete")
    users = []
    if params[:id] # showing a list
      if params[:id].nil? || !User.exists?(:id => params[:id])
Severity: Minor
Found in app/controllers/ops_controller/ops_rbac.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 provision_dialogs_update_create has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def provision_dialogs_update_create
    case params[:button]
    when "add", "save"
      dialog = params[:id].blank? ? MiqDialog.new : MiqDialog.find(params[:id]) # Get new or existing record
      if params[:name].blank?
Severity: Minor
Found in app/controllers/miq_ae_customization_controller/old_dialogs.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 reports_get_node_info has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def reports_get_node_info
    nodes = x_node.split('-')

    if nodes.length == 2
      @right_cell_text ||= _("%{typ} Reports") % {:typ => @sb[:rpt_menu][nodes[1].to_i][0]}
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

Method menu_set_reports_for_group has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  def menu_set_reports_for_group
    @edit[:new].each do |r|
      r.each_slice(2) do |menu, section|
        title = "#{menu}/"
        next if section.nil? || section.class == String
Severity: Minor
Found in app/controllers/report_controller/menus.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

File gtl-view.jsx has 465 lines of code (exceeds 400 allowed). Consider refactoring.
Open

/* eslint-disable no-nested-ternary */
/* eslint-disable react/prop-types */
/* eslint-disable no-console */
import React, { useEffect, useReducer } from 'react';
import PropTypes from 'prop-types';
Severity: Minor
Found in app/javascript/components/gtl-view.jsx - About 3 hrs to fix

Method view_to_url has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def view_to_url(view, parent = nil)
    association = view_to_association(view, parent)
    if association.nil?
      controller, action = db_to_controller(view.db)
      if controller == "ems_cloud" && action == "show"
Severity: Major
Found in app/helpers/application_helper.rb - About 3 hrs to fix

Method settings_update_save has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def settings_update_save
    settings_get_form_vars
    return unless @edit

    case @sb[:active_tab]
Severity: Major
Found in app/controllers/ops_controller/settings/common.rb - About 3 hrs to fix

Method at_tree_select_toggle has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def at_tree_select_toggle(type, edit_key)
    automation_type = params[:automation_type] || default_entry_point_type

    if edit_key
      current_entry_point = @edit[:new][edit_key] # before updating @edit varibale.
Severity: Major
Found in app/helpers/automate_tree_helper.rb - About 3 hrs to fix

Method st_get_form_vars has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def st_get_form_vars
    get_form_vars
    if params[:resource_id]
      # adding new service resource, so need to lookup actual vm or service template record and set defaults
      sr = ServiceTemplate.find(params[:resource_id])
Severity: Major
Found in app/controllers/catalog_controller.rb - About 3 hrs to fix

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

  def show
    assert_privileges("dashboard_view")
    @layout     = "dashboard"
    @display    = "dashboard"
    @lastaction = "show"
Severity: Major
Found in app/controllers/dashboard_controller.rb - About 3 hrs to fix
Severity
Category
Status
Source
Language