ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const getMemoryChart = (isLoading, dashboardData) => {
  if (isLoading !== true) {
    if (dashboardData.data.project_utilization.dataAvailable) {
      const chartData = [];
      let count = 0;
Severity: Major
Found in app/javascript/components/container-projects/helper.jsx and 1 other location - About 2 days to fix
app/javascript/components/container-projects/helper.jsx on lines 102..179

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 478.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const getCPUChart = (isLoading, dashboardData) => {
  if (isLoading !== true) {
    if (dashboardData.data.project_utilization.dataAvailable) {
      const chartData = [];
      let count = 0;
Severity: Major
Found in app/javascript/components/container-projects/helper.jsx and 1 other location - About 2 days to fix
app/javascript/components/container-projects/helper.jsx on lines 181..258

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 478.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

Class CatalogController has 133 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

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

File application_helper.rb has 1152 lines of code (exceeds 400 allowed). Consider refactoring.
Open

module ApplicationHelper
  include ApplicationHelper::ViewsShared
  include ApplicationHelper::Flash
  include ApplicationHelper::Listnav
  include ApplicationHelper::Navbar
Severity: Major
Found in app/helpers/application_helper.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

Class ApplicationController has 123 methods (exceeds 20 allowed). Consider refactoring.
Open

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

  if Vmdb::Application.config.action_controller.allow_forgery_protection
    # Add CSRF protection for this controller, which enables the
Severity: Major
Found in app/controllers/application_controller.rb - About 2 days to fix

Method prov_get_form_vars has a Cognitive Complexity of 118 (exceeds 5 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: Minor
Found in app/controllers/application_controller/miq_request_methods.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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    cy.gtlClickRow([{title: 'Default', number: 1}, {title: 'Compute', number: 2}]).then(() => {
      cy.get(':nth-child(1) > .col-md-8 > .form-control-static').contains('Default');
      cy.get(':nth-child(2) > .col-md-8 > .form-control-static').contains('Compute');

      const headers = ['Group', 'Description (Column Name in Report)', 'Range Start', 'Range Finish', 'Rate Fixed', 'Rate Variable', 'Units'];
Severity: Major
Found in cypress/e2e/ui/Overview/Chargeback/rates.cy.js and 1 other location - About 2 days to fix
cypress/e2e/ui/Overview/Chargeback/rates.cy.js on lines 50..67

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 384.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    cy.gtlClickRow([{title: 'Default Container Image Rate', number: 1}]).then(() => {
      cy.get(':nth-child(1) > .col-md-8 > .form-control-static').contains('Default Container Image Rate');
      cy.get(':nth-child(2) > .col-md-8 > .form-control-static').contains('Compute');

      const headers = ['Group', 'Description (Column Name in Report)', 'Range Start', 'Range Finish', 'Rate Fixed', 'Rate Variable', 'Units'];
Severity: Major
Found in cypress/e2e/ui/Overview/Chargeback/rates.cy.js and 1 other location - About 2 days to fix
cypress/e2e/ui/Overview/Chargeback/rates.cy.js on lines 14..31

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 384.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File buttons.rb has 985 lines of code (exceeds 400 allowed). Consider refactoring.
Open

module ApplicationController::Buttons
  extend ActiveSupport::Concern

  included do
    include Mixins::PlaybookOptions
Severity: Major
Found in app/controllers/application_controller/buttons.rb - About 2 days to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

const FormTemplate = ({
  formFields, recId, modified,
}) => {
  const {
    handleSubmit, onReset, onCancel, getState,
Severity: Major
Found in app/javascript/components/button-group/index.jsx and 1 other location - About 1 day to fix
app/javascript/components/generic-objects-form/custom-button-form/index.jsx on lines 104..150

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 345.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

const FormTemplate = ({
  formFields, recId, modified,
}) => {
  const {
    handleSubmit, onReset, onCancel, getState,
app/javascript/components/button-group/index.jsx on lines 144..190

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 345.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File miq_request_methods.rb has 954 lines of code (exceeds 400 allowed). Consider refactoring.
Open

module ApplicationController::MiqRequestMethods
  extend ActiveSupport::Concern
  include RequestInfoHelper
  included do
    helper_method :dialog_partial_for_workflow
Severity: Major
Found in app/controllers/application_controller/miq_request_methods.rb - About 1 day to fix
Severity
Category
Status
Source
Language