ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method gfv_chargeback has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def gfv_chargeback
    # Chargeback options
    if params.key?(:cb_show_typ)
      @edit[:new][:cb_show_typ] = params[:cb_show_typ].presence
      @refresh_div = "filter_div"
Severity: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 2 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 alert_build_exp_options_info has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def alert_build_exp_options_info
    MiqAlert.expression_options(@edit[:new][:expression][:eval_method]).each do |eo|
      case eo[:name]

      when :ems_id
Severity: Minor
Found in app/controllers/miq_alert_controller.rb - About 2 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 alert_set_record_vars has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def alert_set_record_vars(alert)
    alert.description = @edit[:new][:description]
    alert.enabled = @edit[:new][:enabled]
    alert.severity = @edit[:new][:severity]
    alert.db = @edit[:new][:db]
Severity: Minor
Found in app/controllers/miq_alert_controller.rb - About 2 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 heatmaps has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def heatmaps
    # Get latest hourly rollup for each node.
    cluster_ids = @ems.ems_clusters if @ems.present?
    metrics = MetricRollup.latest_rollups(EmsCluster.name, cluster_ids)
    metrics = metrics.where('timestamp > ?', 30.days.ago.utc).includes(:resource)
Severity: Minor
Found in app/services/ems_infra_dashboard_service.rb - About 2 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 show_adv_search? has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def show_adv_search?
    show_search = %w[
      auth_key_pair_cloud
      availability_zone
      automation_manager_configured_system
Severity: Major
Found in app/helpers/application_helper/page_layouts.rb - About 2 hrs to fix

File helper.jsx has 428 lines of code (exceeds 400 allowed). Consider refactoring.
Open

import React from 'react';
import ChartCard from './chart-card';
import { chartConfig } from '../provider-dashboard-charts/charts_config';
import PfAggregateStatusCard from '../pf_aggregate_status_card';

Severity: Minor
Found in app/javascript/components/container-projects/helper.jsx - About 2 hrs to fix

Class ToolbarChooser has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

class ApplicationHelper::ToolbarChooser
  include RestfulControllerMixin

  # Return a blank tb if a placeholder is needed for AJAX explorer screens, return nil if no center toolbar to be shown
  def center_toolbar_filename
Severity: Minor
Found in app/helpers/application_helper/toolbar_chooser.rb - About 2 hrs to fix

Class MiqAlertSetController has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

class MiqAlertSetController < ApplicationController
  before_action :check_privileges
  before_action :get_session_data
  after_action :cleanup_action
  after_action :set_session_data
Severity: Minor
Found in app/controllers/miq_alert_set_controller.rb - About 2 hrs to fix

Class ChargebackRateController has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

class ChargebackRateController < ApplicationController
  before_action :check_privileges
  before_action :get_session_data
  after_action :cleanup_action
  after_action :set_session_data
Severity: Minor
Found in app/controllers/chargeback_rate_controller.rb - About 2 hrs to fix

Class CloudVolumeController has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

class CloudVolumeController < ApplicationController
  before_action :check_privileges
  before_action :get_session_data
  after_action :cleanup_action
  after_action :set_session_data
Severity: Minor
Found in app/controllers/cloud_volume_controller.rb - About 2 hrs to fix

Class OrchestrationStackController has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

class OrchestrationStackController < ApplicationController
  before_action :check_privileges
  before_action :get_session_data
  after_action :cleanup_action
  after_action :set_session_data
Severity: Minor
Found in app/controllers/orchestration_stack_controller.rb - About 2 hrs to fix

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

  function init(dialog) {

    var sessionStorageId = requestDialogAction() === 'edit' ?
      String(requestDialogId()) : 'new'
    var restoredDialog = DialogEditor.restoreSessionStorage(sessionStorageId);

Method perf_gen_top_data_before_wait has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def perf_gen_top_data_before_wait
    @perf_options[:ght_type] ||= "hybrid"
    @perf_options[:chart_type] = :performance
    cont_plus_model = request.parameters["controller"] + "-" + @perf_options[:top_model]
    metric_model = @perf_options[:top_model] == "Vm" ? "VmOrTemplate" : @perf_options[:top_model]
Severity: Major
Found in app/controllers/application_controller/performance.rb - About 2 hrs to fix

Method exp_button has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def exp_button
    @edit = session[:edit]
    case params[:pressed]
    when "undo", "redo"
      @edit[@expkey][:expression] = @edit[@expkey].history.rewind(params[:pressed])
Severity: Major
Found in app/controllers/application_controller/filter.rb - About 2 hrs to fix

Function miqMenuChangeRow has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.miqMenuChangeRow = function(action, elem) {
  var grid = $('#folder_grid .panel-group');
  var selected = grid.find('.panel-heading.active').parent();

  switch (action) {
Severity: Major
Found in app/javascript/oldjs/miq_tree.js - About 2 hrs to fix

Method miq_summary_alert_parameters has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def miq_summary_alert_parameters(alert, expression_options, sb_data, perf_column_unit, ems)
    rows = []
    title = [_(MiqAlert.expression_types(alert.db)[alert.expression[:eval_method]]), _('Parameters')].join(' ')
    data = {:title => title, :mode => "miq_alert_parameters", :rows => []}
    ae_options = alert.expression[:options]
Severity: Major
Found in app/helpers/miq_alert_helper.rb - About 2 hrs to fix

Method protect has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    if params[:check] # Item was checked/unchecked
Severity: Major
Found in app/controllers/application_controller/policy_support.rb - About 2 hrs to fix

Method prov_field_changed has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def prov_field_changed
    assert_privileges("miq_request_edit")

    if params[:tab_id]
      @edit = session[:edit]
Severity: Major
Found in app/controllers/application_controller/miq_request_methods.rb - About 2 hrs to fix

Method log_depot_edit has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def log_depot_edit
    assert_privileges("#{@sb[:selected_typ] == "miq_server" ? "" : "zone_"}log_depot_edit")
    @record = @sb[:selected_typ].classify.constantize.find(@sb[:selected_server_id])
    # @schedule = nil # setting to nil, since we are using same view for both db_back and log_depot edit
    case params[:button]
Severity: Major
Found in app/controllers/ops_controller/diagnostics.rb - About 2 hrs to fix

Function RetirementForm has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

const RetirementForm = ({
  retirementID, redirect, url, timezone,
}) => {
  const retireItems = JSON.parse(retirementID);
  const tz = timezone;
Severity: Minor
Found in app/javascript/components/retirement-form/index.jsx - About 2 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