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

const getNetworkName = (id, data) => {
  if (data.submitParams.networkIds.add.includes(id)) {
    return __('to be determined');
  }
  return __(' ');
app/javascript/components/reconfigure-vm-form/helpers/network.js on lines 127..132

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

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 getNetworkMac = (id, data) => {
  if (data.submitParams.networkIds.add.includes(id)) {
    return __('not available yet');
  }
  return __(' ');
app/javascript/components/reconfigure-vm-form/helpers/network.js on lines 119..124

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

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

            useEffect(() => {
              // The list of registered fields shows up after this render, so the validation has to happen
              // with a delay and has to be pulled back via the state.
              setTimeout(() => setState((state) => ({ ...state, depsValid: dv })));
              formOptions.change(name, isValid);
Severity: Major
Found in app/javascript/components/async-action-button.jsx and 1 other location - About 1 hr to fix
app/javascript/components/async-credentials/async-credentials.jsx on lines 100..105

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

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 associate_floating_ip_vms
          assert_privileges("instance_associate_floating_ip")
          recs = checked_or_params
          @record = find_record_with_rbac(VmCloud, recs.first)
          if @record.supports?(:associate_floating_ip) && @record.ext_management_system.present?
app/controllers/mixins/actions/vm_actions/disassociate_floating_ip.rb on lines 5..27

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

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 disassociate_floating_ip_vms
          assert_privileges("instance_disassociate_floating_ip")
          recs = checked_or_params
          @record = find_record_with_rbac(VmCloud, recs.first)
          if @record.supports?(:disassociate_floating_ip) && @record.ext_management_system.present?
app/controllers/mixins/actions/vm_actions/associate_floating_ip.rb on lines 5..27

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

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

window.miqOnLoad = function() {
  // controller to be used in url in miqDropComplete method
  ManageIQ.widget.dashboardUrl = 'dashboard/widget_dd_done';

  // Initialize the dashboard column sortables
Severity: Minor
Found in app/javascript/oldjs/miq_application.js - About 1 hr to fix

Function miqInitCodemirror has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.miqInitCodemirror = function(options) {
  if (!miqDomElementExists(options.text_area_id)) {
    return;
  }

Severity: Minor
Found in app/javascript/oldjs/miq_application.js - About 1 hr to fix

Function saveDialogDetails has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function saveDialogDetails() {
    var action;
    var dialogData;
    var dialogId;

Function createSchema has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createSchema(ems, recordId, loadSchema, emptySchema, providerFields = []) {
  const providers = ems.filter((tenant) => tenant.type !== 'ManageIQ::Providers::Nuage::NetworkManager');
  const providerOptions = providers.map(({ id, name }) => ({ label: name, value: id }));
  providerOptions.unshift({ label: `<${__('Choose')}>`, value: '-1' });

Function Quaditem has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Quaditem = (props) => {
  const {
    text, fonticon, color, fileicon, piechart, className, tooltip, background,
  } = props;
  const shortText = abbrNumber(text);
Severity: Minor
Found in app/javascript/components/quadicon/Quaditem.jsx - About 1 hr to fix

Function GenericTableRow has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function GenericTableRow(props) {
  const { item, onClick } = props;
  const value = renderValue(item.value, onClick);

  return (
Severity: Minor
Found in app/javascript/components/textual_summary/generic_table_row.jsx - About 1 hr to fix

Method report_schedule has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def report_schedule(schedules)
    data = {:title => _('Schedules'), :mode => "miq_report_schedules bordered-list simple_table", :rows => []}
    if schedules.blank?
      data[:message] = _("Report is not Scheduled.")
    else
Severity: Minor
Found in app/helpers/report_helper/report_information_helper.rb - About 1 hr to fix

Function componentDidMount has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  componentDidMount() {
    const apiPromises = [];
    const { recordId, gridChecks, dispatch } = this.props;
    const catalogItemsIds = recordId ? [recordId] : _.uniq(gridChecks);

Severity: Minor
Found in app/javascript/components/remove-catalog-item-modal.jsx - About 1 hr to fix

Method list_view has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def list_view(display, record)
    data = {:mode => "miq_host_#{display}"}
    rows = []
    case display
    when "devices"
Severity: Minor
Found in app/helpers/host_helper.rb - About 1 hr to fix

Method set_active_tab has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def set_active_tab(nodetype)
    node = nodetype.downcase.split("-")
    case x_active_tree
    when :settings_tree
      case node[0]
Severity: Minor
Found in app/controllers/ops_controller.rb - About 1 hr to fix

Method prefill_val_types has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def prefill_val_types
      self.val1 ||= {}
      self.val2 ||= {}
      val1[:type] = case exp_typ
                    when 'field'
Severity: Minor
Found in app/controllers/application_controller/filter/expression.rb - About 1 hr to fix

Method chart_chooser has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def chart_chooser
    assert_privileges('utilization')
    unless params[:task_id] # Only do this first time thru
      @sb[:options][:chart_date] = params[:miq_date_1] if params[:miq_date_1]
      @sb[:options][:chart_date] = params[:miq_date_2] if params[:miq_date_2]
Severity: Minor
Found in app/controllers/utilization_controller.rb - About 1 hr to fix

Method add_update_method_add has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def add_update_method_add
    method = params[:id] != "new" ? find_record_with_rbac(MiqAeMethod, params[:id]) : MiqAeMethod.new
    old_method_attributes = method.attributes.clone

    method.name = params["name"]
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr to fix

Method miq_policy_edit_events has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def miq_policy_edit_events
    assert_privileges('miq_policy_events_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 rbac_replace_right_cell has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def rbac_replace_right_cell(nodetype, presenter)
    if %w[accordion_select change_tab tree_select].include?(params[:action])
      presenter.replace(:ops_tabs, r[:partial => "all_tabs"])
    elsif nodetype == "group_seq"
      presenter.update(:rbac_details, r[:partial => "ldap_seq_form"])
Severity: Minor
Found in app/controllers/ops_controller.rb - About 1 hr to fix
Severity
Category
Status
Source
Language