ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

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

        if (values.associations) {
          values.associations.forEach((association) => {
            values.properties.associations[association.associations_name] = association.class;
          });

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 81..86

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

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

      <MiqDataTable
        rows={miqRows.rowItems}
        headers={initialData.headers}
        onCellClick={(selectedRow) => onSelect(selectedRow.id)}
        showPagination={false}
app/javascript/components/settings-company-categories/index.jsx on lines 33..40

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

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

  const loadSchema = (appendState = {}) => ({ data: { form_schema: { fields } } }) => {
    setState((state) => ({
      ...state,
      ...appendState,
      fields,
app/javascript/components/cloud-volume-form/clone-cloud-volume-form.jsx on lines 9..16
app/javascript/components/vm-resize-form/vm-resize-form.jsx on lines 11..18

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

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

  const loadSchema = (appendState = {}) => ({ data: { form_schema: { fields } } }) => {
    setState((state) => ({
      ...state,
      ...appendState,
      fields,
app/javascript/components/cloud-volume-form/attach-detach-cloud-volume-form.jsx on lines 13..20
app/javascript/components/vm-resize-form/vm-resize-form.jsx on lines 11..18

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

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

          if (catalogData.config_info.provision.credential_id) {
            const getSpecificCloudType = API.get(`/api/authentications/${catalogData.config_info.provision.credential_id}`);
            const result = await Promise.resolve(getSpecificCloudType);
            provisionCloudType = result.type;
          }
app/javascript/components/ansible-playbook-edit-catalog-form/index.jsx on lines 84..88
app/javascript/components/ansible-playbook-edit-catalog-form/index.jsx on lines 89..93

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

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 (values.attributes) {
        values.attributes.forEach((attr) => {
          values.properties.attributes[attr.attributes_name] = attr.type;
        });
        delete values.attributes;
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 127..133

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

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 MiqDataTable = ({
  headers,
  rows,
  onCellClick,
  mode,
Severity: Major
Found in app/javascript/components/miq-data-table/index.jsx and 1 other location - About 1 hr to fix
app/javascript/components/gtl-view.jsx on lines 279..518

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

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

      <MiqDataTable
        rows={miqRows.rowItems}
        headers={initialData.headers}
        onCellClick={(selectedRow) => onSelect(selectedRow.id)}
        showPagination={false}
app/javascript/components/settings-label-tag-mapping/index.jsx on lines 47..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 68.

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 GtlView = ({
  flashMessages,
  additionalOptions,
  modelName,
  activeTree,
Severity: Major
Found in app/javascript/components/gtl-view.jsx and 1 other location - About 1 hr to fix
app/javascript/components/miq-data-table/index.jsx on lines 20..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 68.

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 getInitialValues has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const getInitialValues = (emsId, recordId, isTemplate, setState) => {
  const parentOptions = [];
  // Get VM Parent Options and filter out current VM
  API.get(`/api/vms/?filter[]=ems_id=${emsId}&expand=resources`)
    .then(({ resources }) => resources.filter((vm) => vm.id !== `${recordId}`))
Severity: Minor
Found in app/javascript/components/vm-edit-form/helper.js - About 1 hr to fix

Function FontIconPickerDdf has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const FontIconPickerDdf = (props) => {
  const {
    labelText,
    FormGroupProps,
    iconTypes, selected, iconChange,
Severity: Minor
Found in app/javascript/components/fonticon-picker/font-icon-picker-ddf.jsx - About 1 hr to fix

Function setDriveFormSubmit has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const setDriveFormSubmit = (data, setData, formData, renderData) => {
  const { id } = data.editingRow;
  const index = id.substring(5);
  const datatableData = data.dataTable.drives;
  const submitDrives = data.submitParams.drives.connect || [];
Severity: Minor
Found in app/javascript/components/reconfigure-vm-form/helpers/drive.js - About 1 hr to fix

Method timeline_selected has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def timeline_selected(chart_click_data, data_row, ts)
    @record = find_record_with_rbac(data_row["resource_type"].constantize, data_row["resource_id"])
    return [true, nil] unless @record

    controller = data_row["resource_type"].underscore
Severity: Minor
Found in app/controllers/application_controller/performance.rb - About 1 hr to fix

Method settings_set_form_vars has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def settings_set_form_vars
    @right_cell_text = if x_node.split("-").first == "z"
                         if my_zone_name == @selected_zone.name
                           _("Settings %{model} \"%{name}\" (current)") % {:name  => @selected_zone.description,
                                                                           :model => ui_lookup(:model => @selected_zone.class.to_s)}
Severity: Minor
Found in app/controllers/ops_controller/settings/common.rb - About 1 hr to fix

Method rbac_group_seq_edit has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def rbac_group_seq_edit
    assert_privileges("rbac_group_seq_edit")
    case params[:button]
    when "cancel"
      @edit = nil
Severity: Minor
Found in app/controllers/ops_controller/ops_rbac.rb - About 1 hr to fix

Method action_valid_record? has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def action_valid_record?(rec)
    edit = @edit[:new]
    options = edit[:options]
    add_flash(_("Description is required"), :error) if edit[:description].blank?
    add_flash(_("Action Type must be selected"), :error) if edit[:action_type].blank?
Severity: Minor
Found in app/controllers/miq_action_controller.rb - About 1 hr to fix

Method register_nodes has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def register_nodes
    assert_privileges("host_register_nodes")
    redirect_to(ems_infra_path(params[:id], :display => "hosts")) if params[:cancel]

    # Hiding the toolbars
Severity: Minor
Found in app/controllers/ems_infra_controller.rb - About 1 hr to fix

Method prov_redirect has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def prov_redirect(typ = nil)
    assert_privileges(params[:pressed])
    # we need to do this check before doing anything to prevent
    # history being updated
    task_supported(typ) if typ
Severity: Minor
Found in app/controllers/application_controller.rb - About 1 hr to fix

Method export has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def export
    assert_privileges('policy_import_export')
    @breadcrumbs = []
    @layout = "miq_policy_export"
    drop_breadcrumb(:name => _("Import / Export"), :url => "miq_policy_export")
Severity: Minor
Found in app/controllers/miq_policy_export_controller.rb - About 1 hr to fix

Method widget_get_node_info has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def widget_get_node_info
    @sb[:nodes] = x_node.split('-')
    if @sb[:nodes].length == 1
      get_all_widgets
      @right_cell_text = _("All Widgets")
Severity: Minor
Found in app/controllers/report_controller/widgets.rb - About 1 hr to fix
Severity
Category
Status
Source
Language