ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Method build_edit_screen has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

  def build_edit_screen
    build_tabs

    get_time_profiles # Get time profiles list (global and user specific)
    cb_entities_by_provider if Chargeback.db_is_chargeback?(@edit[:new][:model]) && [ChargebackContainerImage, ChargebackContainerProject, MeteringContainerImage, MeteringContainerProject].include?(@edit[:new][:model].safe_constantize)
Severity: Minor
Found in app/controllers/report_controller/reports/editor.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 show has 122 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def show(id = nil)
    @flash_array = [] if params[:display] && params[:display] != "snapshot_info"
    @sb[:action] = params[:display]

    return if perfmenu_click?
Severity: Major
Found in app/controllers/vm_common.rb - About 4 hrs to fix

File textual_summary.rb has 519 lines of code (exceeds 400 allowed). Consider refactoring.
Open

module VmHelper::TextualSummary
  include TextualMixins::TextualAdvancedSettings
  include TextualMixins::TextualDescription
  include TextualMixins::TextualDrift
  include TextualMixins::TextualFilesystems
Severity: Major
Found in app/helpers/vm_helper/textual_summary.rb - About 4 hrs to fix

Function miqBrowserDetect has 121 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.miqBrowserDetect = function() {
  var BrowserDetect = {
    init: function() {
      this.browser = this.searchString(this.dataBrowser) || 'An unknown browser';
      this.version = this.searchVersion(navigator.userAgent) ||
Severity: Major
Found in app/javascript/oldjs/miq_browser_detect.js - About 4 hrs to fix

File dashboard_controller.rb has 518 lines of code (exceeds 400 allowed). Consider refactoring.
Open

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

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

Method included has 120 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.included(included_class)
    included_class.button_group('instance_operations', [
      included_class.select(
        :instance_power_choice,
        nil,

Method alert_field_changed has 120 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def alert_field_changed
    return unless load_edit("miq_alert_edit__#{params[:id]}")

    @alert = @edit[:alert_id] ? MiqAlert.find(@edit[:alert_id]) : MiqAlert.new

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

Function GroupForm has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

const GroupForm = ({
  recId, availableFields, fields, url, appliesToClass, appliesToId, isGenericObject,
}) => {
  const [{
    isLoading, initialValues, buttonIcon, options,
Severity: Minor
Found in app/javascript/components/button-group/index.jsx - 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 prov_set_show_vars has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

  def prov_set_show_vars
    @showtype = "main"
    @options = @miq_request.get_options # Get the provision options from the request record
    @options[:org_controller] = "vm"
    if @options[:schedule_time]
Severity: Minor
Found in app/controllers/application_controller/miq_request_methods.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_dates has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def set_dates(start_date, end_date, allow_interval_override)
      tz = time_profile_tz || self.tz # Use time profile tz or chosen tz, if no profile tz
      self.sdate = start_date.in_time_zone(tz)
      self.edate = end_date.in_time_zone(tz)
      self.sdate_daily = sdate.hour.zero? ? sdate : sdate + 1.day
Severity: Minor
Found in app/controllers/application_controller/performance/options.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 get_node_info has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

  def get_node_info(treenodeid, refresh = nil)
    treenodeid = valid_active_node(treenodeid)
    get_nodetype_and_record(treenodeid)
    @right_cell_text = if @record.kind_of?(MiqEnterprise)
                         _('Enterprise')
Severity: Minor
Found in app/controllers/utilization_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 log_depot_edit has a Cognitive Complexity of 32 (exceeds 5 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: Minor
Found in app/controllers/ops_controller/diagnostics.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

Class GenericObjectDefinitionController has 36 methods (exceeds 20 allowed). Consider refactoring.
Open

class GenericObjectDefinitionController < ApplicationController
  before_action :check_privileges
  before_action :get_session_data

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

Class ExplorerPresenter has 36 methods (exceeds 20 allowed). Consider refactoring.
Open

class ExplorerPresenter
  include ApplicationHelper
  include JsHelper
  include ActionView::Helpers::JavaScriptHelper

Severity: Minor
Found in app/presenters/explorer_presenter.rb - About 4 hrs to fix

File ems_common.rb has 511 lines of code (exceeds 400 allowed). Consider refactoring.
Open

module Mixins
  module EmsCommon
    extend ActiveSupport::Concern

    # This is the list of extracted parts that can be used separately
Severity: Major
Found in app/controllers/mixins/ems_common.rb - About 4 hrs to fix

Function processReplaceRightCell has 116 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ManageIQ.explorer.processReplaceRightCell = function(data) {
  /* variables for the expression editor */
  if (_.isObject(data.expEditor)) {
    if (_.isObject(data.expEditor.first)) {
      if (!_.isUndefined(data.expEditor.first.type)) {
Severity: Major
Found in app/javascript/oldjs/miq_explorer.js - About 4 hrs to fix

Method center_toolbar_filename_classic has 116 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def center_toolbar_filename_classic
    # Original non vmx view code follows
    # toolbar buttons on sub-screens
    to_display = %w[availability_zones cloud_networks cloud_object_store_containers cloud_subnets configured_systems
                    cloud_tenants cloud_volumes cloud_volume_snapshots ems_clusters flavors floating_ips host_aggregates hosts host_initiators host_initiator_groups
Severity: Major
Found in app/helpers/application_helper/toolbar_chooser.rb - About 4 hrs to fix

Function hostData has 115 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const hostData = () => {
  const columns = [
    { is_narrow: true, header_text: '' },
    {
      text: 'Name', sort: 'str', col_idx: 0, align: 'left', header_text: 'Name',
Severity: Major
Found in app/javascript/spec/miq-data-table/data.js - About 4 hrs to fix

Method prov_get_form_vars has 115 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def prov_get_form_vars
    if params[:ids_checked] # User checked/unchecked a tree node
      ids = params[:ids_checked]
      # for some reason if tree is not expanded clicking on radiobuttons this.getAllChecked() sends up extra blanks
      @edit.store_path(:new, tag_symbol_for_workflow, ids.select(&:present?).collect(&:to_i))
Severity: Major
Found in app/controllers/application_controller/miq_request_methods.rb - About 4 hrs to fix

Function GtlView has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

const GtlView = ({
  flashMessages,
  additionalOptions,
  modelName,
  activeTree,
Severity: Minor
Found in app/javascript/components/gtl-view.jsx - 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

Severity
Category
Status
Source
Language