ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

Method miq_summary_policy_events has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def miq_summary_policy_events(policy_events, record)
    data = {:title => _("Events"), :mode => "miq_policy_events"}
    data[:headers] = [_('Description'), _('Actions')]
    rows = []
    if policy_events.empty?
Severity: Minor
Found in app/helpers/miq_policy_helper.rb - About 1 hr to fix

Method javascript_for_timer_type has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def javascript_for_timer_type(timer_type)
    case timer_type
    when "Monthly"
      [
        javascript_hide("weekly_span"),
Severity: Minor
Found in app/helpers/application_helper.rb - About 1 hr to fix

Method exp_token_pressed has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def exp_token_pressed
    @edit = session[:edit]
    token = params[:token].to_i
    if token == @edit[@expkey][:exp_token] || # User selected same token as already selected
       (@edit[@expkey][:exp_token] && @edit[:edit_exp].key?("???")) # or new token in process
Severity: Minor
Found in app/controllers/application_controller/filter.rb - About 1 hr to fix

Method miq_policy_edit_conditions has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def miq_policy_edit_conditions
    assert_privileges('miq_policy_conditions_assignment')
    case params[:button]
    when "cancel"
      @sb[:action] = @edit = nil
Severity: Minor
Found in app/controllers/miq_policy_controller/policies.rb - About 1 hr to fix

Method fields_form_field_changed has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def fields_form_field_changed
    assert_privileges('miq_ae_field_edit')
    return unless load_edit("aefields_edit__#{params[:id]}", "replace_cell__explorer")

    fields_get_form_vars
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr to fix

Method rbac_get_info has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def rbac_get_info
    node, id = x_node.split("-")
    case node
    when "xx"
      case id
Severity: Minor
Found in app/controllers/ops_controller/ops_rbac.rb - About 1 hr to fix

Method gfv_trend has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def gfv_trend
    if params[:chosen_trend_col]
      @edit[:new][:perf_interval] ||= "daily" # Default to Daily
      @edit[:new][:perf_target_pct1] ||= 100  # Default to 100%
      if params[:chosen_trend_col] == "<Choose>"
Severity: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 1 hr to fix

Method alert_build_pulldowns has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def alert_build_pulldowns
    @sb[:alert] ||= {}

    # :event_types
    unless @sb[:alert][:events] # Only create this once
Severity: Minor
Found in app/controllers/miq_alert_controller.rb - About 1 hr to fix

Method attributes_data has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def attributes_data
    attributes = %i[physical_chassis
                    physical_racks
                    physical_servers
                    physical_storages
Severity: Minor
Found in app/services/ems_physical_infra_dashboard_service.rb - About 1 hr to fix

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

  def miq_summary_condition_scope(applies_to_exp_table)
    rows = []
    data = {:title => _('Scope'), :mode => "miq_condition_scope"}
    if !applies_to_exp_table.nil?
      applies_to_exp_table.each do |token|
Severity: Major
Found in app/helpers/condition_helper.rb and 1 other location - About 1 hr to fix
app/helpers/condition_helper.rb on lines 29..44

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

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

  def miq_summary_condition_expression(expression_table)
    rows = []
    data = {:title => _('Expression'), :mode => "miq_condition_expression"}
    if !expression_table.nil?
      expression_table.each do |token|
Severity: Major
Found in app/helpers/condition_helper.rb and 1 other location - About 1 hr to fix
app/helpers/condition_helper.rb on lines 11..26

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

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

      for (const key in enforced) {
        if (initialValues.enforced[key] !== enforced[key] || initialValues.values[key] !== values[key]) {
          fresh = false;
          break;
        }
Severity: Major
Found in app/javascript/components/tenant-quota-form/helper.js and 1 other location - About 1 hr to fix
app/javascript/components/tenant-quota-form/helper.js on lines 27..32

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

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

    for (const key in enforced) {
      if (initialValues.enforced[key] !== enforced[key] || initialValues.values[key] !== values[key]) {
        fresh = false;
        break;
      }
Severity: Major
Found in app/javascript/components/tenant-quota-form/helper.js and 1 other location - About 1 hr to fix
app/javascript/components/tenant-quota-form/helper.js on lines 12..17

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

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 transformCurrenciesOptions = (currencies) => currencies.map((currency) => ({
  label: `${currency.symbol} ${currency.full_name}`,
  value: currency.id,
}));
app/javascript/components/terraform-template-catalog-form/schemaHelper.js on lines 17..20

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

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

    {
      label: 'CPU Usage',
      value: [
        { label: 'Max', value: 'Not Available' },
        { label: 'High', value: '0.00%' },
app/javascript/spec/textual_summary/data/operation_ranges.js on lines 4..12

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

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

PasswordField.propTypes = {
  cancelEditLabel: PropTypes.string,
  changeEditLabel: PropTypes.string,
  helperText: PropTypes.string,
  edit: PropTypes.bool,
app/javascript/components/toolbar/ToolbarClick.jsx on lines 34..41

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

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 transformCurrenciesOptions = (currencies) => currencies.map((currency) => ({
  label: `${currency.symbol} ${currency.full_name}`,
  value: currency.id,
}));
app/javascript/components/ansible-playbook-edit-catalog-form/schemaHelper.js on lines 17..20

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

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

    {
      label: 'CPU',
      value: [
        { label: 'Max', value: 'Not Available' },
        { label: 'High', value: '0 MHz' },
app/javascript/spec/textual_summary/data/operation_ranges.js on lines 13..21

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

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

          Object.entries(initialValues.properties.associations).forEach((attr) => {
            initialValues.associations.push({ associations_name: attr[0], class: attr[1] });
          });
Severity: Major
Found in app/javascript/components/generic-objects-form/index.jsx and 1 other location - About 1 hr to fix
app/javascript/components/generic-objects-form/index.jsx on lines 40..42

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

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

ToolbarClick.propTypes = {
  title: PropTypes.string,
  text: PropTypes.string,
  id: PropTypes.string,
  hidden: PropTypes.bool,
Severity: Major
Found in app/javascript/components/toolbar/ToolbarClick.jsx and 1 other location - About 1 hr to fix
app/javascript/components/async-credentials/password-field.jsx on lines 85..92

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

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