ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

Method create has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create
    assert_privileges("cloud_volume_new")
    case params[:button]
    when "cancel"
      flash_and_redirect(_("Add of new Cloud Volume was cancelled by the user"))
Severity: Minor
Found in app/controllers/cloud_volume_controller.rb - About 1 hr to fix

Method pxe_image_edit has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def pxe_image_edit
    assert_privileges("pxe_image_edit")
    case params[:button]
    when "cancel"
      add_flash(_("Edit of PXE Image \"%{name}\" was cancelled by the user") % {:name => session[:edit][:img].name})
Severity: Minor
Found in app/controllers/pxe_controller/pxe_servers.rb - About 1 hr to fix

Method alert_build_exp_options_info has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def alert_build_exp_options_info
    MiqAlert.expression_options(@edit[:new][:expression][:eval_method]).each do |eo|
      case eo[:name]

      when :ems_id
Severity: Minor
Found in app/controllers/miq_alert_controller.rb - About 1 hr to fix

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

        const element = { ...data[key], nodeId, nodes: data[key].nodes.map((child) => `${node.nodeId}.${child}`) };
Severity: Major
Found in app/javascript/components/tree-view/base.jsx and 1 other location - About 1 hr to fix
app/javascript/components/tree-view/redux.jsx on lines 123..123

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

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

          const element = { ...data[key], nodeId, nodes: data[key].nodes.map((child) => `${node.nodeId}.${child}`) };
Severity: Major
Found in app/javascript/components/tree-view/redux.jsx and 1 other location - About 1 hr to fix
app/javascript/components/tree-view/base.jsx on lines 54..54

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

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

ServiceDialogFromOt.propTypes = {
  templateId: PropTypes.number.isRequired,
  dialogClass: PropTypes.string.isRequired,
  templateClass: PropTypes.string.isRequired,
  miqRedirectBackAdress: PropTypes.string.isRequired,
app/javascript/components/provider-dashboard-charts/usage-network-image-charts/index.js on lines 42..47

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

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 restructureOptions = (data) => {
  if (!data) { return []; } return data.map((item) => (
    ({ label: item.name, value: item.id })
  ));
};
Severity: Major
Found in app/javascript/components/evacuate-form/helper.js and 1 other location - About 1 hr to fix
app/javascript/components/live-migrate-form/helper.js on lines 4..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 64.

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 restructureOptions = (data) => {
  if (!data) { return []; } return data.map((item) => (
    ({ label: item.name, value: item.id })
  ));
};
Severity: Major
Found in app/javascript/components/live-migrate-form/helper.js and 1 other location - About 1 hr to fix
app/javascript/components/evacuate-form/helper.js on lines 4..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 64.

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 renderSpinner = (spinnerOn) => {
      if (spinnerOn) {
        return (
          <div className="loadingSpinner">
            <Loading active small withOverlay={false} className="loading" />
Severity: Major
Found in app/javascript/components/remove-catalog-item-modal.jsx and 1 other location - About 1 hr to fix
app/javascript/components/remove-generic-item-modal.jsx on lines 181..189

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

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 renderSpinner = (spinnerOn) => {
      if (spinnerOn) {
        return (
          <div className="loadingSpinner">
            <Loading active small withOverlay={false} className="loading" />
Severity: Major
Found in app/javascript/components/remove-generic-item-modal.jsx and 1 other location - About 1 hr to fix
app/javascript/components/remove-catalog-item-modal.jsx on lines 142..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 64.

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 policySetNotesData = {
  title: _('Notes'),
  mode: 'miq_policy_set_notes',
  message: 'No notes have been entered.',
  items: [
Severity: Major
Found in app/javascript/spec/miq-policy-set/miq-policy-set.data.js and 1 other location - About 1 hr to fix
app/javascript/spec/miq-condition/miq-condition.data.js on lines 60..71

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

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 conditionNotes = {
  title: _('Notes'),
  mode: 'miq_condition_notes',
  message: 'No notes have been entered.',
  items: [
Severity: Major
Found in app/javascript/spec/miq-condition/miq-condition.data.js and 1 other location - About 1 hr to fix
app/javascript/spec/miq-policy-set/miq-policy-set.data.js on lines 51..62

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

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

UsageTrendChart.propTypes = {
  providerId: PropTypes.string.isRequired,
  config: PropTypes.string.isRequired,
  apiUrl: PropTypes.string.isRequired,
  dataPoint: PropTypes.string.isRequired,
app/javascript/components/service-dialog-from-form/service-dialog-from.jsx on lines 38..43

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

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

Function onSubmitData has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const onSubmitData = (values, miqRequestInitialOptions) => {
  // Request Date (created_recently)
  if (values.selectedPeriod) { // user selected
    daysAgo = values.selectedPeriod;
  } else if (miqRequestInitialOptions.timePeriods[1] && miqRequestInitialOptions.timePeriods[1].value) {
Severity: Minor
Found in app/javascript/components/service-request-default/index.jsx - About 1 hr to fix

Function gtlReducer has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const gtlReducer = (state, action) => {
  switch (action.type) {
    case 'dataLoaded':
      if (state && state.additionalOptions && state.additionalOptions.checkboxes_clicked
        && state.additionalOptions.checkboxes_clicked.length === 0) {
Severity: Minor
Found in app/javascript/components/gtl-view.jsx - About 1 hr to fix

Method textual_group_endpoints has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def textual_group_endpoints
    endpoints = @record.endpoints.where.not(:role => 'default')
    return if endpoints.nil?

    endpoints_types = {
Severity: Minor
Found in app/helpers/ems_container_helper/textual_summary.rb - About 1 hr to fix

Method policy_build_edit_screen has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def policy_build_edit_screen(edit_type = nil)
    @edit = {}
    @edit[:new] = {}
    @edit[:current] = {}
    @edit[:key] = "miq_policy_edit__#{@policy.id || "new"}"
Severity: Minor
Found in app/controllers/miq_policy_controller/policies.rb - About 1 hr to fix

Method fields_seq_edit has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def fields_seq_edit
    assert_privileges("miq_ae_field_seq")
    case params[:button]
    when "cancel"
      @sb[:action] = session[:edit] = nil # clean out the saved info
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr to fix

Method rbac_group_user_lookup has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def rbac_group_user_lookup
    assert_privileges(params[:id] == "new" ? "rbac_group_add" : "rbac_group_edit")


    rbac_group_user_lookup_field_changed
Severity: Minor
Found in app/controllers/ops_controller/ops_rbac.rb - About 1 hr to fix

Method build_filtered_item_list has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def build_filtered_item_list(action_type, filter_type)
    case filter_type
    when "vm"
      filtered_item_list = find_filtered(Vm).sort_by { |vm| vm.name.downcase }.collect(&:name).uniq
    when "miq_template"
Severity: Minor
Found in app/controllers/ops_controller/settings/schedules.rb - About 1 hr to fix
Severity
Category
Status
Source
Language