ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

Method perf_util_summary_section has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def perf_util_summary_section(s)
    ss = []

    # Fill in the single day data from the timestamp report
    ts_rpt = @sb[:ts_rpt]
Severity: Major
Found in app/controllers/application_controller/performance.rb - About 2 hrs to fix

Method data_for_breadcrumbs has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def data_for_breadcrumbs(controller_options = {})
      options = breadcrumbs_options || {}
      options[:record_info] ||= (@record || {})
      options[:record_title] ||= :name
      options[:not_tree] ||= false
Severity: Major
Found in app/controllers/mixins/breadcrumbs_mixin.rb - About 2 hrs to fix

Method status has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def status
    routes_count = if @ems.present?
                     @ems.respond_to?(:container_routes) ? @ems.container_routes.count : 0 # ems might not have routes
                   else
                     ContainerRoute.count
Severity: Major
Found in app/services/container_dashboard_service.rb - About 2 hrs to fix

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

        if ((modelDate && copyDate && (modelDate.diff(copyDate, 'days') == 0)) || (!modelDate && !copyDate)) {
          scope.angularForm[scope['formchange_' + ctrl.$name]].$setPristine();
          scope.angularForm[scope['formchange_' + ctrl.$name]].$setUntouched();
          scope.angularForm.$pristine = true;
        } else {
Severity: Major
Found in app/javascript/oldjs/directives/checkchange.js and 1 other location - About 2 hrs to fix
app/javascript/oldjs/directives/checkchange.js on lines 52..61

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

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

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

        if ((Array.isArray(modelCopy()[ctrl.$name]) &&
          angular.equals(model()[ctrl.$name], modelCopy()[ctrl.$name])) ||
          ctrl.$viewValue === modelCopy()[ctrl.$name]) {
          scope.angularForm[scope['formchange_' + ctrl.$name]].$setPristine();
          scope.angularForm[scope['formchange_' + ctrl.$name]].$setUntouched();
Severity: Major
Found in app/javascript/oldjs/directives/checkchange.js and 1 other location - About 2 hrs to fix
app/javascript/oldjs/directives/checkchange.js on lines 68..75

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

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

    currency_with_delimiter: function(val, options) {
      options = options || {};
      var av_options = _.pick(options, [ 'delimiter', 'separator' ]);
      val = apply_format_precision(val, options.precision);
      val = number_to_currency(val, av_options);
Severity: Major
Found in app/javascript/oldjs/miq_formatters.js and 1 other location - About 2 hrs to fix
app/javascript/oldjs/miq_formatters.js on lines 124..130

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

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

  while (index <= 2.99) {
    const valueInGB = Math.round((index * 1024 * 1024 * 1024) * 10) / 10;
    options.push({
      value: valueInGB,
      label: toHumanSize(valueInGB),
Severity: Major
Found in app/javascript/components/workers-form/helpers.jsx and 1 other location - About 2 hrs to fix
app/javascript/components/workers-form/helpers.jsx on lines 152..159

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

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

    number_with_delimiter: function(val, options) {
      options = options || {};
      var av_options = _.pick(options, [ 'delimiter', 'separator' ]);
      val = apply_format_precision(val, options.precision);
      val = number_with_delimiter(val, av_options);
Severity: Major
Found in app/javascript/oldjs/miq_formatters.js and 1 other location - About 2 hrs to fix
app/javascript/oldjs/miq_formatters.js on lines 132..138

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

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

  while (index <= 1.55) {
    const valueInGB = Math.round((index * 1024 * 1024 * 1024) * 10) / 10;
    options.push({
      value: valueInGB,
      label: toHumanSize(valueInGB),
Severity: Major
Found in app/javascript/components/workers-form/helpers.jsx and 1 other location - About 2 hrs to fix
app/javascript/components/workers-form/helpers.jsx on lines 189..196

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

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 textual_summary.rb has 408 lines of code (exceeds 400 allowed). Consider refactoring.
Open

module HostHelper::TextualSummary
  include TextualMixins::TextualCustomButtonEvents
  include TextualMixins::TextualDevices
  include TextualMixins::TextualOsInfo
  include TextualMixins::TextualVmmInfo
Severity: Minor
Found in app/helpers/host_helper/textual_summary.rb - About 2 hrs to fix

Class WorkflowRepositoryController has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

class WorkflowRepositoryController < ApplicationController
  before_action :check_prototype

  before_action :check_privileges
  before_action :get_session_data
Severity: Minor
Found in app/controllers/workflow_repository_controller.rb - About 2 hrs to fix

Class ContainerDashboardController has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

class ContainerDashboardController < ApplicationController
  extend ActiveSupport::Concern

  include Mixins::GenericSessionMixin
  include Mixins::BreadcrumbsMixin
Severity: Minor
Found in app/controllers/container_dashboard_controller.rb - About 2 hrs to fix

Function loadTable has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const loadTable = (values, tz, users) => {
  const filters = [];
  const {
    zone, timePeriod, taskStatus, taskState, user,
  } = values; // User selected values
Severity: Major
Found in app/javascript/components/settings-tasks-form/load-table-helper.js - About 2 hrs to fix

Method rbac_group_right_tree has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def rbac_group_right_tree(selected_nodes)
    case @sb[:active_rbac_group_tab]
    when 'rbac_customer_tags'
      cats = Classification.categories.select do |c|
        c.show || !%w[folder_path_blue folder_path_yellow].include?(c.name) && !(c.read_only? || c.entries.empty?)
Severity: Major
Found in app/controllers/ops_controller/ops_rbac.rb - About 2 hrs to fix

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

const buildModeOptions = (mode) => {
  const modeArray = [];
  mode.forEach((pt) => {
    const tempObj = { label: pt[0], value: pt[1] };
    modeArray.push(tempObj);
Severity: Major
Found in app/javascript/components/miq-alert-set-form/helper.js and 3 other locations - About 2 hrs to fix
app/javascript/components/action-form/helper.js on lines 150..157
app/javascript/components/action-form/helper.js on lines 159..166
app/javascript/components/action-form/helper.js on lines 168..175

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

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 4 locations. Consider refactoring.
Open

const buildInheritTagOptions = (inheritTags) => {
  const inheritTagArray = [];
  inheritTags.forEach((it) => {
    const tempObj = { label: it[1], value: it[0] };
    inheritTagArray.push(tempObj);
Severity: Major
Found in app/javascript/components/action-form/helper.js and 3 other locations - About 2 hrs to fix
app/javascript/components/action-form/helper.js on lines 159..166
app/javascript/components/action-form/helper.js on lines 168..175
app/javascript/components/miq-alert-set-form/helper.js on lines 1..8

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

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 4 locations. Consider refactoring.
Open

const buildRunAnsible = (ansibleOptions) => {
  const ansibleOptionsArray = [];
  ansibleOptions.forEach((ao) => {
    const tempObj = { label: ao[0], value: ao[0] };
    ansibleOptionsArray.push(tempObj);
Severity: Major
Found in app/javascript/components/action-form/helper.js and 3 other locations - About 2 hrs to fix
app/javascript/components/action-form/helper.js on lines 150..157
app/javascript/components/action-form/helper.js on lines 159..166
app/javascript/components/miq-alert-set-form/helper.js on lines 1..8

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

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 4 locations. Consider refactoring.
Open

const buildAlertOptions = (alertOptions) => {
  const alertOptionArray = [];
  alertOptions.forEach((ao) => {
    const tempObj = { label: ao[0], value: ao[1] };
    alertOptionArray.push(tempObj);
Severity: Major
Found in app/javascript/components/action-form/helper.js and 3 other locations - About 2 hrs to fix
app/javascript/components/action-form/helper.js on lines 150..157
app/javascript/components/action-form/helper.js on lines 168..175
app/javascript/components/miq-alert-set-form/helper.js on lines 1..8

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

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

              <ul>
                {data.map((item) => (
                  <li key={item.id}><h4><strong>{item.name}</strong></h4></li>
                ))}
              </ul>
Severity: Major
Found in app/javascript/components/remove-generic-item-modal.jsx and 1 other location - About 2 hrs to fix
app/javascript/components/remove-catalog-item-modal.jsx on lines 161..165

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

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

  if (!miqSearchSpinner.spinner) {
    miqSearchSpinner.spinner = new Spinner({
      lines: 13, // The number of lines to draw
      length: 20, // The length of each line
      width: 10, // The line thickness
Severity: Major
Found in app/javascript/oldjs/miq_application.js and 1 other location - About 2 hrs to fix
app/javascript/oldjs/miq_application.js on lines 1010..1020

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

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

Severity
Category
Status
Source
Language