ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,382 of 18,382 total issues

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

File application_helper.rb has 1144 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

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 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

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

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,
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

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

File miq_request_methods.rb has 953 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

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

  return (
    <div className="utilization-cpu-chart-pf">
      <div className="utilization-trend-chart-pf">
        <h3>{config.title}</h3>
        <div className="current-values">
app/javascript/components/provider-dashboard-charts/provider-dashboard-utilization-chart/utilizationMemoryDonutChart.js on lines 79..107

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 338.

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

  return (
    <div className="utilization-memory-chart-pf">
      <div className="utilization-trend-chart-pf">
        <h3>{config.title}</h3>
        <div className="current-values">
app/javascript/components/provider-dashboard-charts/provider-dashboard-utilization-chart/utilizationDonutChart.js on lines 79..108

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 338.

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

Method prepare_data_for_compare_or_drift_report has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
Open

  def prepare_data_for_compare_or_drift_report(mode, csv)
    sb_key = mode == :compare ? :miq_temp_params : :miq_drift_params

    # Collect the data from the @compare object
    @data = []
Severity: Minor
Found in app/controllers/application_controller/compare.rb - About 1 day 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 91 (exceeds 5 allowed). Consider refactoring.
Open

  def replace_right_cell(options = {})
    if params[:action] == 'x_history'
      # Making selected checkboxes array empty when compare cancel is clicked
      params[:miq_grid_checks] = []
    end
Severity: Minor
Found in app/controllers/vm_common.rb - About 1 day 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 91 (exceeds 5 allowed). Consider refactoring.
Open

  def replace_right_cell(options = {})
    action, replace_trees, presenter = options.values_at(:action, :replace_trees, :presenter)
    @explorer = true

    # FIXME: make this functional
Severity: Minor
Found in app/controllers/catalog_controller.rb - About 1 day 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