ManageIQ/manageiq-ui-classic

View on GitHub

Showing 1,992 of 18,382 total issues

File mockdata.js has 6111 lines of code (exceeds 400 allowed). Consider refactoring.
Open

export const initalDataForFirstTestCase = {
    "catalogFormId": "148",
    "allCatalogs": [
        [
            "My Company/AWS",
Severity: Major
Found in app/javascript/spec/ansible-edit-catalog-form/mockdata.js - About 2 wks to fix

File routes.rb has 3180 lines of code (exceeds 400 allowed). Consider refactoring.
Open

Rails.application.routes.draw do
  # rubocop:disable Layout/HashAlignment
  # rubocop:disable Layout/MultilineOperationIndentation
  # default routes for each controller
  default_routes = %w[
Severity: Major
Found in config/routes.rb - About 1 wk to fix

File miq_ae_class_controller.rb has 2546 lines of code (exceeds 400 allowed). Consider refactoring.
Open

require "rexml/document"
class MiqAeClassController < ApplicationController
  include MiqAeClassHelper
  include AutomateTreeHelper
  include Mixins::GenericSessionMixin
Severity: Major
Found in app/controllers/miq_ae_class_controller.rb - About 6 days to fix

Method update_from_expression_editor has a Cognitive Complexity of 271 (exceeds 5 allowed). Consider refactoring.
Open

    def update_from_expression_editor(params)
      if params[:chosen_typ] && params[:chosen_typ] != exp_typ
        change_exp_typ(params[:chosen_typ])
      else
        case exp_typ
Severity: Minor
Found in app/controllers/application_controller/filter/expression.rb - About 5 days 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 catalog_controller.rb has 2111 lines of code (exceeds 400 allowed). Consider refactoring.
Open

class CatalogController < ApplicationController
  include AutomateTreeHelper
  include Mixins::ServiceDialogCreationMixin
  include Mixins::BreadcrumbsMixin
  include Mixins::AutomationMixin
Severity: Major
Found in app/controllers/catalog_controller.rb - About 5 days to fix

File compare.rb has 1629 lines of code (exceeds 400 allowed). Consider refactoring.
Open

module ApplicationController::Compare
  extend ActiveSupport::Concern

  DRIFT_TIME_COLUMNS = %w[last_scan_on boot_time last_logon].freeze

Severity: Major
Found in app/controllers/application_controller/compare.rb - About 3 days to fix

File application_controller.rb has 1526 lines of code (exceeds 400 allowed). Consider refactoring.
Open

require 'open-uri'

class ApplicationController < ActionController::Base
  include Vmdb::Logging

Severity: Major
Found in app/controllers/application_controller.rb - About 3 days to fix

File editor.rb has 1488 lines of code (exceeds 400 allowed). Consider refactoring.
Open

module ReportController::Reports::Editor
  extend ActiveSupport::Concern

  included do
    helper_method :cashed_reporting_available_fields, :cashed_reporting_available_fields
Severity: Major
Found in app/controllers/report_controller/reports/editor.rb - About 3 days to fix

Class MiqAeClassController has 162 methods (exceeds 20 allowed). Consider refactoring.
Open

class MiqAeClassController < ApplicationController
  include MiqAeClassHelper
  include AutomateTreeHelper
  include Mixins::GenericSessionMixin
  include Mixins::BreadcrumbsMixin
Severity: Major
Found in app/controllers/miq_ae_class_controller.rb - About 3 days to fix

Method settings_get_form_vars has a Cognitive Complexity of 156 (exceeds 5 allowed). Consider refactoring.
Open

  def settings_get_form_vars
    settings_load_edit
    return unless @edit

    @in_a_form = true
Severity: Minor
Found in app/controllers/ops_controller/settings/common.rb - About 3 days 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 153 (exceeds 5 allowed). Consider refactoring.
Open

  def replace_right_cell(options = {})
    @explorer = true
    action = options[:action]
    replace_trees = options[:replace_trees] || []
    get_node_info unless @in_a_form
Severity: Minor
Found in app/controllers/report_controller.rb - About 3 days 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 ap_edit has a Cognitive Complexity of 141 (exceeds 5 allowed). Consider refactoring.
Open

  def ap_edit
    assert_privileges("ap_edit")
    if params["accept"]
      ap_accept_line_changes
    else
Severity: Minor
Found in app/controllers/ops_controller/settings/analysis_profiles.rb - About 2 days 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_application.js has 1216 lines of code (exceeds 400 allowed). Consider refactoring.
Open

/* global add_flash getChartColumnDataValues getChartFormatedValue miqBrowserDetect miqExpressionPrefill miqFlashLater miqFlashSaved miqGridCheckAll miqGridGetCheckedRows miqMenu miqTreeObject miqValueStylePrefill recalculateChartYAxisLabels */

// MIQ specific JS functions

// Things to be done on page loads
Severity: Major
Found in app/javascript/oldjs/miq_application.js - About 2 days to fix

Method st_get_form_vars has a Cognitive Complexity of 131 (exceeds 5 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: Minor
Found in app/controllers/catalog_controller.rb - About 2 days 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 performance.rb has 1202 lines of code (exceeds 400 allowed). Consider refactoring.
Open

module ApplicationController::Performance
  extend ActiveSupport::Concern

  CHARTS_REPORTS_FOLDER = Rails.root.join("product", "charts", "miq_reports")
  CHARTS_LAYOUTS_FOLDER = Rails.root.join("product", "charts", "layouts")
Severity: Major
Found in app/controllers/application_controller/performance.rb - About 2 days to fix

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

function createSchema(recordId, promise, inheritTags, evaluateAlert, tags, ansibleInventory, snapshotAge, parentType, inventoryType) {
  const subForm = [
    {
      component: componentTypes.SUB_FORM,
      id: 'subform-1',
Severity: Major
Found in app/javascript/components/action-form/action-form.schema.js - About 2 days to fix

File ops_rbac.rb has 1180 lines of code (exceeds 400 allowed). Consider refactoring.
Open

module OpsController::OpsRbac
  extend ActiveSupport::Concern

  TAG_DB_TO_NAME = {
    'MiqGroup' => 'group',
Severity: Major
Found in app/controllers/ops_controller/ops_rbac.rb - About 2 days to fix

File vm_common.rb has 1172 lines of code (exceeds 400 allowed). Consider refactoring.
Open

module VmCommon
  extend ActiveSupport::Concern
  include ActionView::Helpers::JavaScriptHelper
  include Mixins::ChargebackPreviewMixin
  include ProvisionCustomizeHelper
Severity: Major
Found in app/controllers/vm_common.rb - About 2 days to fix

Class CatalogController has 131 methods (exceeds 20 allowed). Consider refactoring.
Open

class CatalogController < ApplicationController
  include AutomateTreeHelper
  include Mixins::ServiceDialogCreationMixin
  include Mixins::BreadcrumbsMixin
  include Mixins::AutomationMixin
Severity: Major
Found in app/controllers/catalog_controller.rb - About 2 days to fix

Method menu_field_changed has a Cognitive Complexity of 123 (exceeds 5 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: Minor
Found in app/controllers/report_controller/menus.rb - About 2 days 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