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

  button_group('rbac_role_vmdb', [
    select(
      :rbac_role_vmdb_choice,
      nil,
      t = N_('Configuration'),
Severity: Major
Found in app/helpers/application_helper/toolbar/user_roles_center.rb and 1 other location - About 1 hr to fix
app/helpers/application_helper/toolbar/users_center.rb on lines 2..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 71.

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

  button_group('user_vmdb', [
    select(
      :user_vmdb_choice,
      nil,
      t = N_('Configuration'),
Severity: Major
Found in app/helpers/application_helper/toolbar/users_center.rb and 1 other location - About 1 hr to fix
app/helpers/application_helper/toolbar/user_roles_center.rb on lines 2..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 71.

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 evacuate_form_fields
          assert_privileges("instance_evacuate")
          @record = find_record_with_rbac(VmOrTemplate, params[:id])
          hosts = []
          unless @record.ext_management_system.nil?
Severity: Major
Found in app/controllers/mixins/actions/vm_actions/evacuate.rb and 1 other location - About 1 hr to fix
app/controllers/mixins/actions/vm_actions/live_migrate.rb on lines 32..55

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

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 live_migrate_form_fields
          assert_privileges("instance_live_migrate")
          @record = find_record_with_rbac(VmOrTemplate, params[:id])
          hosts = []
          unless @record.ext_management_system.nil?
Severity: Major
Found in app/controllers/mixins/actions/vm_actions/live_migrate.rb and 1 other location - About 1 hr to fix
app/controllers/mixins/actions/vm_actions/evacuate.rb on lines 50..70

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

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

window.chartData = function(type, data, data2) {
  if (type === undefined) {
    return emptyChart();
  }

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

Function getPodsTable has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const getPodsTable = (isLoading, dashboardData) => {
  if (isLoading !== true) {
    if (dashboardData.data.pods.length > 0) {
      const rows = dashboardData.data.pods.map((row) => ({
        ...row,
Severity: Minor
Found in app/javascript/components/container-projects/helper.jsx - About 1 hr to fix

Function FirmwareRegistryForm has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const FirmwareRegistryForm = () => {
  const TYPES = {
    rest_api_depot: { value: 'FirmwareRegistry::RestApiDepot', label: __('Rest API Depot') },
  };

Function render has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const { isLoaded } = this.props;

    if (!isLoaded) {
      return (
Severity: Minor
Found in app/javascript/components/taggingWrapper.jsx - About 1 hr to fix

Method process_vm_buttons has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def process_vm_buttons(pfx)
    case params[:pressed]
    when "#{pfx}_policy_sim"                then polsimvms
    when "#{pfx}_compare"                   then comparemiq
    when "#{pfx}_scan"                      then scanvms
Severity: Minor
Found in app/controllers/application_controller/ci_processing.rb - About 1 hr to fix

Method textual_generate_openstack_status has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def textual_generate_openstack_status
    @record.service_group_names.collect do |x|
      running_count = @record.host_ids_with_running_service_group(x.name).count
      failed_count  = @record.host_ids_with_failed_service_group(x.name).count
      all_count     = @record.host_ids_with_service_group(x.name).count
Severity: Minor
Found in app/helpers/ems_cluster_helper/textual_summary.rb - About 1 hr to fix

Method disks_attributes has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def disks_attributes
      disks = []
      return disks if @record.hardware.disks.empty?

      # HDDs
Severity: Minor
Found in app/helpers/textual_mixins/textual_devices.rb - About 1 hr to fix

Method ab_group_reorder has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def ab_group_reorder
    assert_privileges("ab_group_reorder")
    case params[:button]
    when "cancel"
      add_flash(_("Button Group Reorder cancelled"))
Severity: Minor
Found in app/controllers/application_controller/buttons.rb - About 1 hr to fix

Method update has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def update
    assert_privileges("miq_ae_class_edit")
    return unless load_edit("aeclass_edit__#{params[:id]}", "replace_cell__explorer")

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

Method upload_csv has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def upload_csv
    assert_privileges("region_edit")

    return unless load_edit("#{@sb[:active_tab]}_edit__#{@sb[:selected_server_id]}", "replace_cell__explorer")

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

Method rbac_user_delete has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def rbac_user_delete
    assert_privileges("rbac_user_delete")
    users = []
    if params[:id] # showing a list
      if params[:id].nil? || !User.exists?(:id => params[:id])
Severity: Minor
Found in app/controllers/ops_controller/ops_rbac.rb - About 1 hr to fix

Method determine_filter_type_and_value has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def determine_filter_type_and_value(schedule)
    if schedule.sched_action && schedule.sched_action[:method] && !schedule_automate(schedule)
      if schedule.miq_search # See if a search filter is attached
        filter_type = schedule.miq_search.search_type == "user" ? "my" : "global"
        filter_value = schedule.miq_search.id
Severity: Minor
Found in app/controllers/ops_controller/settings/schedules.rb - About 1 hr to fix

Method send_button_changes has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def send_button_changes
      if @edit
        @changed = (@edit[:new] != @edit[:current])
      elsif @assign
        @changed = (@assign[:new] != @assign[:current])
Severity: Minor
Found in app/controllers/mixins/policy_mixin.rb - About 1 hr to fix

Method set_record_vars has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def set_record_vars
    @edit[:set_assignments] = []
    if @edit[:new][:cbshow_typ].ends_with?("-tags")
      assigned_rates_from_all_categories = @edit[:cb_assign][:tags].values.reduce({}, :merge)
      assigned_rates_from_all_categories.each_key do |id|
Severity: Minor
Found in app/controllers/chargeback_assignment_controller.rb - About 1 hr to fix

Method gfv_charts has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def gfv_charts
    if params[:chosen_graph] && params[:chosen_graph] != @edit[:new][:graph_type]
      if params[:chosen_graph] == "<No chart>"
        @edit[:new][:graph_type] = nil
        # Reset other setting to initial settings if choosing <No chart>
Severity: Minor
Found in app/controllers/report_controller/reports/editor.rb - About 1 hr to fix

Method features has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def features
    [
      {
        :role     => "miq_report_saved_reports",
        :role_any => true,
Severity: Minor
Found in app/controllers/report_controller.rb - About 1 hr to fix
Severity
Category
Status
Source
Language