ManageIQ/manageiq

View on GitHub

Showing 322 of 1,314 total issues

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

  def clone_volume_queue(userid, options = {})
    task_opts = {
      :action => "cloning Cloud Volume for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/cloud_volume/operations.rb and 6 other locations - About 40 mins to fix
app/models/cloud_database.rb on lines 72..88
app/models/cloud_volume.rb on lines 96..112
app/models/host_initiator_group.rb on lines 86..102
app/models/manageiq/providers/cloud_manager/template.rb on lines 93..109
app/models/physical_storage.rb on lines 139..155
app/models/storage_service.rb on lines 77..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 37.

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 update_security_policy_rule_queue(userid, options = {})
    task_opts = {
      :action => "updating Security Policy Rule for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/security_policy_rule.rb and 8 other locations - About 40 mins to fix
app/models/cloud_network.rb on lines 58..72
app/models/cloud_network.rb on lines 83..97
app/models/host_aggregate.rb on lines 42..56
app/models/security_group.rb on lines 40..54
app/models/security_group.rb on lines 65..79
app/models/security_policy.rb on lines 22..36
app/models/security_policy.rb on lines 47..61
app/models/security_policy_rule.rb on lines 58..72

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

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 topts[:compute_filter]
          search = if topts[:compute_filter].kind_of?(MiqSearch)
                     topts[:compute_filter]
                   else
                     MiqSearch.find(topts[:compute_filter])
Severity: Minor
Found in app/models/vim_performance_analysis.rb and 1 other location - About 40 mins to fix
app/models/vim_performance_analysis.rb on lines 89..98

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

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 delete_security_policy_queue(userid, options = {})
    task_opts = {
      :action => "deleting Security Policy for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/security_policy.rb and 8 other locations - About 40 mins to fix
app/models/cloud_network.rb on lines 58..72
app/models/cloud_network.rb on lines 83..97
app/models/host_aggregate.rb on lines 42..56
app/models/security_group.rb on lines 40..54
app/models/security_group.rb on lines 65..79
app/models/security_policy.rb on lines 22..36
app/models/security_policy_rule.rb on lines 33..47
app/models/security_policy_rule.rb on lines 58..72

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

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 update_cloud_network_queue(userid, options = {})
    task_opts = {
      :action => "updating Cloud Network for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/cloud_network.rb and 8 other locations - About 40 mins to fix
app/models/cloud_network.rb on lines 83..97
app/models/host_aggregate.rb on lines 42..56
app/models/security_group.rb on lines 40..54
app/models/security_group.rb on lines 65..79
app/models/security_policy.rb on lines 22..36
app/models/security_policy.rb on lines 47..61
app/models/security_policy_rule.rb on lines 33..47
app/models/security_policy_rule.rb on lines 58..72

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

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 topts[:storage_filter]
          search = if topts[:storage_filter].kind_of?(MiqSearch)
                     topts[:storage_filter]
                   else
                     MiqSearch.find(topts[:storage_filter])
Severity: Minor
Found in app/models/vim_performance_analysis.rb and 1 other location - About 40 mins to fix
app/models/vim_performance_analysis.rb on lines 73..82

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

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 delete_security_policy_rule_queue(userid, options = {})
    task_opts = {
      :action => "deleting Security Policy Rule for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/security_policy_rule.rb and 8 other locations - About 40 mins to fix
app/models/cloud_network.rb on lines 58..72
app/models/cloud_network.rb on lines 83..97
app/models/host_aggregate.rb on lines 42..56
app/models/security_group.rb on lines 40..54
app/models/security_group.rb on lines 65..79
app/models/security_policy.rb on lines 22..36
app/models/security_policy.rb on lines 47..61
app/models/security_policy_rule.rb on lines 33..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 37.

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

  def update_volume_queue(userid, options = {})
    task_opts = {
      :action => "updating Cloud Volume for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/cloud_volume.rb and 6 other locations - About 40 mins to fix
app/models/cloud_database.rb on lines 72..88
app/models/cloud_volume/operations.rb on lines 31..46
app/models/host_initiator_group.rb on lines 86..102
app/models/manageiq/providers/cloud_manager/template.rb on lines 93..109
app/models/physical_storage.rb on lines 139..155
app/models/storage_service.rb on lines 77..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 37.

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 update_security_policy_queue(userid, options = {})
    task_opts = {
      :action => "updating Security Policy for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/security_policy.rb and 8 other locations - About 40 mins to fix
app/models/cloud_network.rb on lines 58..72
app/models/cloud_network.rb on lines 83..97
app/models/host_aggregate.rb on lines 42..56
app/models/security_group.rb on lines 40..54
app/models/security_group.rb on lines 65..79
app/models/security_policy.rb on lines 47..61
app/models/security_policy_rule.rb on lines 33..47
app/models/security_policy_rule.rb on lines 58..72

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

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 delete_security_group_queue(userid, options = {})
    task_opts = {
      :action => "deleting Security Group for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/security_group.rb and 8 other locations - About 40 mins to fix
app/models/cloud_network.rb on lines 58..72
app/models/cloud_network.rb on lines 83..97
app/models/host_aggregate.rb on lines 42..56
app/models/security_group.rb on lines 40..54
app/models/security_policy.rb on lines 22..36
app/models/security_policy.rb on lines 47..61
app/models/security_policy_rule.rb on lines 33..47
app/models/security_policy_rule.rb on lines 58..72

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

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

  def update_storage_service_queue(userid, options = {})
    task_opts = {
      :action => "updating Storage Service for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/storage_service.rb and 6 other locations - About 40 mins to fix
app/models/cloud_database.rb on lines 72..88
app/models/cloud_volume.rb on lines 96..112
app/models/cloud_volume/operations.rb on lines 31..46
app/models/host_initiator_group.rb on lines 86..102
app/models/manageiq/providers/cloud_manager/template.rb on lines 93..109
app/models/physical_storage.rb on lines 139..155

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

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 purge_by_date(older_than, window = nil, &block)
      _log.info("Purging #{table_name.humanize} older than [#{older_than}]...")
      total = purge_in_batches(purge_scope(older_than), window || purge_window_size, &block)
      _log.info("Purging #{table_name.humanize} older than [#{older_than}]...Complete - Deleted #{total} records")
      total
Severity: Minor
Found in app/models/mixins/purging_mixin.rb and 1 other location - About 40 mins to fix
app/models/mixins/purging_mixin.rb on lines 100..104

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

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

  def update_host_initiator_group_queue(userid, options = {})
    task_opts = {
      :action => "updating Host Initiator Group for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/host_initiator_group.rb and 6 other locations - About 40 mins to fix
app/models/cloud_database.rb on lines 72..88
app/models/cloud_volume.rb on lines 96..112
app/models/cloud_volume/operations.rb on lines 31..46
app/models/manageiq/providers/cloud_manager/template.rb on lines 93..109
app/models/physical_storage.rb on lines 139..155
app/models/storage_service.rb on lines 77..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 37.

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

          ActiveRecord::Base.transaction do
            # associate parent templates to child instances
            parent_miq_templates = miq_templates_inventory_collection.model_class
                                                                     .where(:id => vms_genealogy_parents.values).find_each.index_by(&:id)
            vms_inventory_collection.model_class
app/models/manageiq/providers/inventory/persister/builder/cloud_manager.rb on lines 191..197

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

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 purge_by_remaining(remaining, window = nil, &block)
      _log.info("Purging #{table_name.humanize} older than last #{remaining} results...")
      total = purge_in_batches(purge_ids_for_remaining(remaining), window || purge_window_size, &block)
      _log.info("Purging #{table_name.humanize} older than last #{remaining} results...Complete - Deleted #{total} records")
      total
Severity: Minor
Found in app/models/mixins/purging_mixin.rb and 1 other location - About 40 mins to fix
app/models/mixins/purging_mixin.rb on lines 86..90

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

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

    self.class.column_names.each do |cname|
      # Remove any columns that we do not want to export
      next if %w[id created_on updated_on updated_by].include?(cname) || cname.ends_with?("_id")

      # Skip any columns that we process explicitly
Severity: Minor
Found in app/models/miq_ae_value.rb and 1 other location - About 40 mins to fix
app/models/miq_ae_class.rb on lines 76..84

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

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 update_security_group_queue(userid, options = {})
    task_opts = {
      :action => "updating Security Group for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/security_group.rb and 8 other locations - About 40 mins to fix
app/models/cloud_network.rb on lines 58..72
app/models/cloud_network.rb on lines 83..97
app/models/host_aggregate.rb on lines 42..56
app/models/security_group.rb on lines 65..79
app/models/security_policy.rb on lines 22..36
app/models/security_policy.rb on lines 47..61
app/models/security_policy_rule.rb on lines 33..47
app/models/security_policy_rule.rb on lines 58..72

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

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 update_aggregate_queue(userid, options = {})
    task_opts = {
      :action => "updating Host Aggregate for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/host_aggregate.rb and 8 other locations - About 40 mins to fix
app/models/cloud_network.rb on lines 58..72
app/models/cloud_network.rb on lines 83..97
app/models/security_group.rb on lines 40..54
app/models/security_group.rb on lines 65..79
app/models/security_policy.rb on lines 22..36
app/models/security_policy.rb on lines 47..61
app/models/security_policy_rule.rb on lines 33..47
app/models/security_policy_rule.rb on lines 58..72

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

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

  def update_physical_storage_queue(userid, options = {})
    task_opts = {
      :action => "updating PhysicalStorage for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/physical_storage.rb and 6 other locations - About 40 mins to fix
app/models/cloud_database.rb on lines 72..88
app/models/cloud_volume.rb on lines 96..112
app/models/cloud_volume/operations.rb on lines 31..46
app/models/host_initiator_group.rb on lines 86..102
app/models/manageiq/providers/cloud_manager/template.rb on lines 93..109
app/models/storage_service.rb on lines 77..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 37.

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

  def update_cloud_database_queue(userid, options = {})
    task_opts = {
      :action => "updating Cloud Database for user #{userid}",
      :userid => userid
    }
Severity: Major
Found in app/models/cloud_database.rb and 6 other locations - About 40 mins to fix
app/models/cloud_volume.rb on lines 96..112
app/models/cloud_volume/operations.rb on lines 31..46
app/models/host_initiator_group.rb on lines 86..102
app/models/manageiq/providers/cloud_manager/template.rb on lines 93..109
app/models/physical_storage.rb on lines 139..155
app/models/storage_service.rb on lines 77..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 37.

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