ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method ap_ce_select has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

  def ap_ce_select
    assert_privileges(session&.fetch_path(:edit, :current, :scan_mode) == "Vm" ? "ap_vm_edit" : "ap_host_edit")

    return unless load_edit("ap_edit__#{params[:id]}", "replace_cell__explorer")

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

  def label_tag_mapping_edit
    assert_privileges("region_edit")

    case params[:button]
    when "cancel"
Severity: Minor
Found in app/controllers/ops_controller/settings/label_tag_mapping.rb - About 4 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_record_vars has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

  def set_record_vars
    @edit[:set_assignments] = []
    if @edit[:new][:cbshow_typ].ends_with?("-tags")
      assigned_rates_from_all_categories = @edit[:cb_assign][:tags].values.reduce({}, :merge)
      assigned_rates_from_all_categories.each_key do |id|
Severity: Minor
Found in app/controllers/chargeback_assignment_controller.rb - About 4 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 old_dialogs_update_create has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

  def old_dialogs_update_create
    old_dialogs_get_form_vars
    case params[:button]
    when "cancel"
      @edit = session[:edit] = nil # clean out the saved info
Severity: Minor
Found in app/controllers/miq_ae_customization_controller/old_dialogs.rb - About 4 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 form_method_field_changed has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def form_method_field_changed
    assert_privileges(feature_by_action)
    return unless load_edit("aemethod_edit__#{params[:id]}", "replace_cell__explorer")

    get_method_form_vars
Severity: Major
Found in app/controllers/miq_ae_class_controller.rb - About 4 hrs to fix

Method ab_get_node_info has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def ab_get_node_info(node)
    @nodetype = node.split("_")
    nodeid = node.split("-")

    # initializing variables to hold data for selected node
Severity: Major
Found in app/controllers/miq_ae_customization_controller/custom_buttons.rb - About 4 hrs to fix

Method widget_set_form_vars has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def widget_set_form_vars
    @timezone_abbr = get_timezone_abbr
    @edit = {}
    @edit[:widget_id] = @widget.id
    @edit[:read_only] = !!@widget.read_only
Severity: Major
Found in app/controllers/report_controller/widgets.rb - About 4 hrs to fix

Class MiqAeToolsController has 33 methods (exceeds 20 allowed). Consider refactoring.
Open

class MiqAeToolsController < ApplicationController
  include Mixins::BreadcrumbsMixin
  before_action :check_privileges
  before_action :get_session_data
  after_action :cleanup_action
Severity: Minor
Found in app/controllers/miq_ae_tools_controller.rb - About 4 hrs to fix

Method atomic_req_submit has 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def atomic_req_submit
    id = session[:edit][:req_id] || "new"
    return unless load_edit("prov_edit__#{id}", "show_list")

    if @edit[:new][:name].blank?
Severity: Major
Found in app/controllers/catalog_controller.rb - About 4 hrs to fix

Method menu_field_changed has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def menu_field_changed
    assert_privileges("miq_report_menu_editor")

    return unless load_edit("menu_edit__#{session[:role_choice] ? session[:role_choice] : "new"}", "replace_cell__explorer")
    menu_get_form_vars
Severity: Major
Found in app/controllers/report_controller/menus.rb - About 4 hrs to fix

File catalog_item_form_controller.js has 488 lines of code (exceeds 400 allowed). Consider refactoring.
Open

ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', '$timeout', 'catalogItemFormId', 'currentRegion', 'miqService', 'postService', 'catalogItemDataFactory', 'playbookReusableCodeMixin', 'allCatalogsNames', 'additionalTenantIds', function($scope, $timeout, catalogItemFormId, currentRegion, miqService, postService, catalogItemDataFactory, playbookReusableCodeMixin, allCatalogsNames, additionalTenantIds) {
  var vm = this;
  var init = function() {
    vm.catalogItemModel = {
      name: '',

File dashboards.rb has 487 lines of code (exceeds 400 allowed). Consider refactoring.
Open

module ReportController::Dashboards
  extend ActiveSupport::Concern
  include DashboardHelper

  def db_seq_edit
Severity: Minor
Found in app/controllers/report_controller/dashboards.rb - About 4 hrs to fix

Method prov_redirect has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

  def prov_redirect(typ = nil)
    assert_privileges(params[:pressed])
    # we need to do this check before doing anything to prevent
    # history being updated
    task_supported(typ) if typ
Severity: Minor
Found in app/controllers/application_controller.rb - About 4 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_set_record_vars has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

  def widget_set_record_vars(widget)
    widget.title       = @edit[:new][:title]
    widget.description = @edit[:new][:description]
    widget.enabled     = @edit[:new][:enabled]
    widget.options ||= {}
Severity: Minor
Found in app/controllers/report_controller/widgets.rb - About 4 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 TreeView has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TreeView = (props) => {
  const {
    tree_name,
    bs_tree,
    check_url,
Severity: Major
Found in app/javascript/components/tree-view/redux.jsx - About 4 hrs to fix

Method diagnostics_set_form_vars has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def diagnostics_set_form_vars
    active_node = x_node
    if active_node && active_node.split('-').first == "z"
      @record = @selected_server = Zone.find_by(:id => active_node.split('-').last)
      @sb[:selected_server_id] = @selected_server.id
Severity: Major
Found in app/controllers/ops_controller/diagnostics.rb - About 4 hrs to fix

Function createRows has 100 lines of code (exceeds 25 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: Major
Found in app/javascript/components/tenant-quota-form/helper.js - About 4 hrs to fix

Method get_view has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def get_view(db, options = {}, fetch_data = false)
    if !fetch_data && @report_data_additional_options.nil?
      process_show_list_options(options, db)
    end
    if @in_a_form && @edit.present?
Severity: Major
Found in app/controllers/application_controller.rb - About 4 hrs to fix

Function menuItemOnClick has 99 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const menuItemOnClick = (menuItems, widgetId, dataMethod, href, buttonTitle, widgetType, widgetTitle, setState, widgetModel, lastRun, nextRun) => {
  let index = 0;
  // Handles Minimize button and changes it to Maximize after click
  if (buttonTitle === __('Minimize')) {
    document.getElementById(`dd_w${widgetId}_box`).style.display = 'none';
Severity: Major
Found in app/javascript/components/dashboard-widgets/widget-wrapper/helper.jsx - About 3 hrs to fix

Method alert_build_edit_screen has 98 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def alert_build_edit_screen
    @edit = {}
    @edit[:new] = {}
    @edit[:current] = {}

Severity: Major
Found in app/controllers/miq_alert_controller.rb - About 3 hrs to fix
Severity
Category
Status
Source
Language