ManageIQ/manageiq

View on GitHub

Showing 322 of 1,314 total issues

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

  def self.create_volume_mapping_queue(userid, ext_management_system, options = {})
    task_opts = {
      :action => "creating VolumeMapping for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/volume_mapping.rb and 8 other locations - About 35 mins to fix
app/models/cloud_object_store_container.rb on lines 24..39
app/models/cloud_volume.rb on lines 61..76
app/models/flavor.rb on lines 58..73
app/models/host_initiator.rb on lines 29..44
app/models/host_initiator_group.rb on lines 29..44
app/models/manageiq/providers/cloud_manager/auth_key_pair.rb on lines 17..32
app/models/storage_service.rb on lines 20..35
app/models/storage_service.rb on lines 118..131

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

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

    if req_obj.source.nil?
      # Single source has not been selected yet
      if req_obj.options[:src_ids].length == 1
        v = Vm.find_by(:id => req_obj.options[:src_ids].first)
        name = v.nil? ? "" : v.name
Severity: Minor
Found in app/models/vm_cloud_reconfigure_task.rb and 1 other location - About 35 mins to fix
app/models/vm_migrate_task.rb on lines 15..24

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

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

  def self.create_volume_queue(userid, ext_management_system, options = {})
    task_opts = {
      :action => "creating Cloud Volume for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/cloud_volume.rb and 8 other locations - About 35 mins to fix
app/models/cloud_object_store_container.rb on lines 24..39
app/models/flavor.rb on lines 58..73
app/models/host_initiator.rb on lines 29..44
app/models/host_initiator_group.rb on lines 29..44
app/models/manageiq/providers/cloud_manager/auth_key_pair.rb on lines 17..32
app/models/storage_service.rb on lines 20..35
app/models/storage_service.rb on lines 118..131
app/models/volume_mapping.rb on lines 54..69

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

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

    if req_obj.source.nil?
      # Single source has not been selected yet
      if req_obj.options[:src_ids].length == 1
        v = Vm.find_by(:id => req_obj.options[:src_ids].first)
        name = v.nil? ? "" : v.name
Severity: Minor
Found in app/models/vm_migrate_task.rb and 1 other location - About 35 mins to fix
app/models/vm_cloud_reconfigure_task.rb on lines 14..23

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

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

  def delete_queue(userid)
    task_opts = {
      :action => "deleting Cloud Volume Backup for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/cloud_volume_backup.rb and 10 other locations - About 35 mins to fix
app/models/cloud_database.rb on lines 45..61
app/models/cloud_volume.rb on lines 126..142
app/models/cloud_volume.rb on lines 153..169
app/models/host_initiator.rb on lines 71..85
app/models/host_initiator_group.rb on lines 61..75
app/models/manageiq/providers/cloud_manager/auth_key_pair.rb on lines 49..65
app/models/manageiq/providers/cloud_manager/template.rb on lines 123..139
app/models/physical_storage.rb on lines 52..66
app/models/storage_service.rb on lines 52..66
app/models/volume_mapping.rb on lines 37..51

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

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 self.xml_to_hashes(xml_node, find_path)
    result = []
    if xml_node.kind_of?(Array)
      return xml_node
    else
Severity: Minor
Found in app/models/advanced_setting.rb and 1 other location - About 35 mins to fix
app/models/firewall_rule.rb on lines 30..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 34.

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

  set_columns_hash(
    :configured_system_id    => :integer,
    :configured_system_name  => :string,
    :configured_system_uid   => :string,
    :configured_system_guid  => :string,
Severity: Minor
Found in app/models/chargeback_configured_system.rb and 1 other location - About 35 mins to fix
app/models/chargeback_container_project.rb on lines 2..19

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

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 config_info[:manager_id] && config_info[:manager_id] != orchestration_manager.try(:id)
      self.orchestration_manager = ExtManagementSystem.find(config_info[:manager_id])
    elsif config_info[:manager] && config_info[:manager] != orchestration_manager
      self.orchestration_manager = config_info[:manager]
    end
Severity: Minor
Found in app/models/service_template_orchestration.rb and 1 other location - About 35 mins to fix
app/models/service_template_orchestration.rb on lines 61..65

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

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 config_info[:template_id] && config_info[:template_id] != orchestration_template.try(:id)
      self.orchestration_template = OrchestrationTemplate.find(config_info[:template_id])
    elsif config_info[:template] && config_info[:template] != orchestration_template
      self.orchestration_template = config_info[:template]
    end
Severity: Minor
Found in app/models/service_template_orchestration.rb and 1 other location - About 35 mins to fix
app/models/service_template_orchestration.rb on lines 67..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 34.

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

  def delete_cloud_database_queue(userid)
    task_opts = {
      :action => "deleting Cloud Database for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/cloud_database.rb and 10 other locations - About 35 mins to fix
app/models/cloud_volume.rb on lines 126..142
app/models/cloud_volume.rb on lines 153..169
app/models/cloud_volume_backup.rb on lines 48..64
app/models/host_initiator.rb on lines 71..85
app/models/host_initiator_group.rb on lines 61..75
app/models/manageiq/providers/cloud_manager/auth_key_pair.rb on lines 49..65
app/models/manageiq/providers/cloud_manager/template.rb on lines 123..139
app/models/physical_storage.rb on lines 52..66
app/models/storage_service.rb on lines 52..66
app/models/volume_mapping.rb on lines 37..51

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

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

  def delete_host_initiator_group_queue(userid)
    task_opts = {
      :action => "deleting Host Initiator Group for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/host_initiator_group.rb and 10 other locations - About 35 mins to fix
app/models/cloud_database.rb on lines 45..61
app/models/cloud_volume.rb on lines 126..142
app/models/cloud_volume.rb on lines 153..169
app/models/cloud_volume_backup.rb on lines 48..64
app/models/host_initiator.rb on lines 71..85
app/models/manageiq/providers/cloud_manager/auth_key_pair.rb on lines 49..65
app/models/manageiq/providers/cloud_manager/template.rb on lines 123..139
app/models/physical_storage.rb on lines 52..66
app/models/storage_service.rb on lines 52..66
app/models/volume_mapping.rb on lines 37..51

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

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 self.with_roles_excluding(identifier, allowed_ids: nil)
    scope = where.not(
      :id => MiqUserRole
        .unscope(:select)
        .joins(:miq_product_features)
Severity: Minor
Found in app/models/miq_user_role.rb and 1 other location - About 35 mins to fix
app/models/miq_group.rb on lines 65..74

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

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

  def delete_volume_queue(userid)
    task_opts = {
      :action => "deleting Cloud Volume for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/cloud_volume.rb and 10 other locations - About 35 mins to fix
app/models/cloud_database.rb on lines 45..61
app/models/cloud_volume.rb on lines 153..169
app/models/cloud_volume_backup.rb on lines 48..64
app/models/host_initiator.rb on lines 71..85
app/models/host_initiator_group.rb on lines 61..75
app/models/manageiq/providers/cloud_manager/auth_key_pair.rb on lines 49..65
app/models/manageiq/providers/cloud_manager/template.rb on lines 123..139
app/models/physical_storage.rb on lines 52..66
app/models/storage_service.rb on lines 52..66
app/models/volume_mapping.rb on lines 37..51

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

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

  def safe_delete_volume_queue(userid)
    task_opts = {
      :action => "Safe deleting Cloud Volume for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/cloud_volume.rb and 10 other locations - About 35 mins to fix
app/models/cloud_database.rb on lines 45..61
app/models/cloud_volume.rb on lines 126..142
app/models/cloud_volume_backup.rb on lines 48..64
app/models/host_initiator.rb on lines 71..85
app/models/host_initiator_group.rb on lines 61..75
app/models/manageiq/providers/cloud_manager/auth_key_pair.rb on lines 49..65
app/models/manageiq/providers/cloud_manager/template.rb on lines 123..139
app/models/physical_storage.rb on lines 52..66
app/models/storage_service.rb on lines 52..66
app/models/volume_mapping.rb on lines 37..51

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

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

def process(accessor, dir)
  puts "Reading #{accessor}..."
  data = yield
  puts "Writing #{accessor}..."
  File.open(File.join(dir, "#{accessor}.yml"), "w") { |f| f.write(data.to_yaml(:SortKeys => true)) }
Severity: Minor
Found in tools/vim_collect_inventory.rb and 1 other location - About 35 mins to fix
tools/vim_collect_perf_history.rb on lines 59..64

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

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

  def delete_host_initiator_queue(userid)
    task_opts = {
      :action => "deleting host initiator for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/host_initiator.rb and 10 other locations - About 35 mins to fix
app/models/cloud_database.rb on lines 45..61
app/models/cloud_volume.rb on lines 126..142
app/models/cloud_volume.rb on lines 153..169
app/models/cloud_volume_backup.rb on lines 48..64
app/models/host_initiator_group.rb on lines 61..75
app/models/manageiq/providers/cloud_manager/auth_key_pair.rb on lines 49..65
app/models/manageiq/providers/cloud_manager/template.rb on lines 123..139
app/models/physical_storage.rb on lines 52..66
app/models/storage_service.rb on lines 52..66
app/models/volume_mapping.rb on lines 37..51

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

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 self.with_roles_excluding(identifier, allowed_ids: nil)
    scope = where.not(
      :id => MiqGroup
        .unscope(:select)
        .joins(:miq_product_features)
Severity: Minor
Found in app/models/miq_group.rb and 1 other location - About 35 mins to fix
app/models/miq_user_role.rb on lines 68..77

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

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

  def delete_key_pair_queue(userid)
    task_opts = {
      :action => "deleting Auth Key Pair for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/manageiq/providers/cloud_manager/auth_key_pair.rb and 10 other locations - About 35 mins to fix
app/models/cloud_database.rb on lines 45..61
app/models/cloud_volume.rb on lines 126..142
app/models/cloud_volume.rb on lines 153..169
app/models/cloud_volume_backup.rb on lines 48..64
app/models/host_initiator.rb on lines 71..85
app/models/host_initiator_group.rb on lines 61..75
app/models/manageiq/providers/cloud_manager/template.rb on lines 123..139
app/models/physical_storage.rb on lines 52..66
app/models/storage_service.rb on lines 52..66
app/models/volume_mapping.rb on lines 37..51

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

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

  def delete_storage_service_queue(userid)
    task_opts = {
      :action => "deleting Storage Service for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/storage_service.rb and 10 other locations - About 35 mins to fix
app/models/cloud_database.rb on lines 45..61
app/models/cloud_volume.rb on lines 126..142
app/models/cloud_volume.rb on lines 153..169
app/models/cloud_volume_backup.rb on lines 48..64
app/models/host_initiator.rb on lines 71..85
app/models/host_initiator_group.rb on lines 61..75
app/models/manageiq/providers/cloud_manager/auth_key_pair.rb on lines 49..65
app/models/manageiq/providers/cloud_manager/template.rb on lines 123..139
app/models/physical_storage.rb on lines 52..66
app/models/volume_mapping.rb on lines 37..51

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

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

  def delete_image_queue(userid)
    task_opts = {
      :action => "Deleting Cloud Template for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/manageiq/providers/cloud_manager/template.rb and 10 other locations - About 35 mins to fix
app/models/cloud_database.rb on lines 45..61
app/models/cloud_volume.rb on lines 126..142
app/models/cloud_volume.rb on lines 153..169
app/models/cloud_volume_backup.rb on lines 48..64
app/models/host_initiator.rb on lines 71..85
app/models/host_initiator_group.rb on lines 61..75
app/models/manageiq/providers/cloud_manager/auth_key_pair.rb on lines 49..65
app/models/physical_storage.rb on lines 52..66
app/models/storage_service.rb on lines 52..66
app/models/volume_mapping.rb on lines 37..51

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

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