crowbar/crowbar-openstack

View on GitHub

Showing 748 of 748 total issues

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

  def apply_role_pre_chef_call(old_role, role, all_nodes)
    @logger.debug("Designate apply_role_pre_chef_call: entering #{all_nodes.inspect}")
    return if all_nodes.empty?

    vip_networks = ["admin", "public"]
Severity: Major
Found in crowbar_framework/app/models/designate_service.rb and 2 other locations - About 1 hr to fix
crowbar_framework/app/models/heat_service.rb on lines 91..112
crowbar_framework/app/models/sahara_service.rb on lines 99..121

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

  def apply_role_pre_chef_call(old_role, role, all_nodes)
    @logger.debug("Heat apply_role_pre_chef_call: entering #{all_nodes.inspect}")
    return if all_nodes.empty?

    vip_networks = ["admin", "public"]
Severity: Major
Found in crowbar_framework/app/models/heat_service.rb and 2 other locations - About 1 hr to fix
crowbar_framework/app/models/designate_service.rb on lines 129..151
crowbar_framework/app/models/sahara_service.rb on lines 99..121

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

  def apply_role_pre_chef_call(old_role, role, all_nodes)
    @logger.debug("sahara apply_role_pre_chef_call: entering #{all_nodes.inspect}")
    return if all_nodes.empty?

    vip_networks = ["admin", "public"]
Severity: Major
Found in crowbar_framework/app/models/sahara_service.rb and 2 other locations - About 1 hr to fix
crowbar_framework/app/models/designate_service.rb on lines 129..151
crowbar_framework/app/models/heat_service.rb on lines 91..112

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

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

Method make_volume has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def make_volume(node, backend_id, volume)
  volname = volume[:raw][:volume_name]
  cinder_raw_method = volume[:raw][:cinder_raw_method]

  return if volume_exists(volname)
Severity: Minor
Found in chef/cookbooks/cinder/recipes/volume.rb - About 1 hr to fix

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

if node[:barbican][:api][:protocol] == "https"
  ssl_setup "setting up ssl for barbican" do
    generate_certs node[:barbican][:ssl][:generate_certs]
    certfile node[:barbican][:ssl][:certfile]
    keyfile node[:barbican][:ssl][:keyfile]
Severity: Major
Found in chef/cookbooks/barbican/recipes/api.rb and 7 other locations - About 1 hr to fix
chef/cookbooks/cinder/recipes/api.rb on lines 34..42
chef/cookbooks/designate/recipes/api.rb on lines 26..34
chef/cookbooks/glance/recipes/api.rb on lines 30..38
chef/cookbooks/heat/recipes/server.rb on lines 93..101
chef/cookbooks/manila/recipes/common.rb on lines 146..154
chef/cookbooks/neutron/recipes/server.rb on lines 41..49
chef/cookbooks/watcher/recipes/server.rb on lines 11..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 64.

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

if node[:neutron][:api][:protocol] == "https"
  ssl_setup "setting up ssl for neutron" do
    generate_certs node[:neutron][:ssl][:generate_certs]
    certfile node[:neutron][:ssl][:certfile]
    keyfile node[:neutron][:ssl][:keyfile]
Severity: Major
Found in chef/cookbooks/neutron/recipes/server.rb and 7 other locations - About 1 hr to fix
chef/cookbooks/barbican/recipes/api.rb on lines 38..46
chef/cookbooks/cinder/recipes/api.rb on lines 34..42
chef/cookbooks/designate/recipes/api.rb on lines 26..34
chef/cookbooks/glance/recipes/api.rb on lines 30..38
chef/cookbooks/heat/recipes/server.rb on lines 93..101
chef/cookbooks/manila/recipes/common.rb on lines 146..154
chef/cookbooks/watcher/recipes/server.rb on lines 11..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 64.

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

if node[:glance][:api][:protocol] == "https"
  ssl_setup "setting up ssl for glance" do
    generate_certs node[:glance][:ssl][:generate_certs]
    certfile node[:glance][:ssl][:certfile]
    keyfile node[:glance][:ssl][:keyfile]
Severity: Major
Found in chef/cookbooks/glance/recipes/api.rb and 7 other locations - About 1 hr to fix
chef/cookbooks/barbican/recipes/api.rb on lines 38..46
chef/cookbooks/cinder/recipes/api.rb on lines 34..42
chef/cookbooks/designate/recipes/api.rb on lines 26..34
chef/cookbooks/heat/recipes/server.rb on lines 93..101
chef/cookbooks/manila/recipes/common.rb on lines 146..154
chef/cookbooks/neutron/recipes/server.rb on lines 41..49
chef/cookbooks/watcher/recipes/server.rb on lines 11..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 64.

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

if node[:designate][:api][:protocol] == "https"
  ssl_setup "setting up ssl for designate" do
    generate_certs node[:designate][:ssl][:generate_certs]
    certfile node[:designate][:ssl][:certfile]
    keyfile node[:designate][:ssl][:keyfile]
Severity: Major
Found in chef/cookbooks/designate/recipes/api.rb and 7 other locations - About 1 hr to fix
chef/cookbooks/barbican/recipes/api.rb on lines 38..46
chef/cookbooks/cinder/recipes/api.rb on lines 34..42
chef/cookbooks/glance/recipes/api.rb on lines 30..38
chef/cookbooks/heat/recipes/server.rb on lines 93..101
chef/cookbooks/manila/recipes/common.rb on lines 146..154
chef/cookbooks/neutron/recipes/server.rb on lines 41..49
chef/cookbooks/watcher/recipes/server.rb on lines 11..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 64.

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

if node[:heat][:api][:protocol] == "https"
  ssl_setup "setting up ssl for heat" do
    generate_certs node[:heat][:ssl][:generate_certs]
    certfile node[:heat][:ssl][:certfile]
    keyfile node[:heat][:ssl][:keyfile]
Severity: Major
Found in chef/cookbooks/heat/recipes/server.rb and 7 other locations - About 1 hr to fix
chef/cookbooks/barbican/recipes/api.rb on lines 38..46
chef/cookbooks/cinder/recipes/api.rb on lines 34..42
chef/cookbooks/designate/recipes/api.rb on lines 26..34
chef/cookbooks/glance/recipes/api.rb on lines 30..38
chef/cookbooks/manila/recipes/common.rb on lines 146..154
chef/cookbooks/neutron/recipes/server.rb on lines 41..49
chef/cookbooks/watcher/recipes/server.rb on lines 11..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 64.

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

if node[:manila][:api][:protocol] == "https"
  ssl_setup "setting up ssl for manila" do
    generate_certs node[:manila][:ssl][:generate_certs]
    certfile node[:manila][:ssl][:certfile]
    keyfile node[:manila][:ssl][:keyfile]
Severity: Major
Found in chef/cookbooks/manila/recipes/common.rb and 7 other locations - About 1 hr to fix
chef/cookbooks/barbican/recipes/api.rb on lines 38..46
chef/cookbooks/cinder/recipes/api.rb on lines 34..42
chef/cookbooks/designate/recipes/api.rb on lines 26..34
chef/cookbooks/glance/recipes/api.rb on lines 30..38
chef/cookbooks/heat/recipes/server.rb on lines 93..101
chef/cookbooks/neutron/recipes/server.rb on lines 41..49
chef/cookbooks/watcher/recipes/server.rb on lines 11..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 64.

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

if node[:cinder][:api][:protocol] == "https"
  ssl_setup "setting up ssl for cinder" do
    generate_certs node[:cinder][:ssl][:generate_certs]
    certfile node[:cinder][:ssl][:certfile]
    keyfile node[:cinder][:ssl][:keyfile]
Severity: Major
Found in chef/cookbooks/cinder/recipes/api.rb and 7 other locations - About 1 hr to fix
chef/cookbooks/barbican/recipes/api.rb on lines 38..46
chef/cookbooks/designate/recipes/api.rb on lines 26..34
chef/cookbooks/glance/recipes/api.rb on lines 30..38
chef/cookbooks/heat/recipes/server.rb on lines 93..101
chef/cookbooks/manila/recipes/common.rb on lines 146..154
chef/cookbooks/neutron/recipes/server.rb on lines 41..49
chef/cookbooks/watcher/recipes/server.rb on lines 11..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 64.

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

if node[:watcher][:api][:protocol] == "https"
  ssl_setup "setting up ssl for watcher" do
    generate_certs node[:watcher][:ssl][:generate_certs]
    certfile node[:watcher][:ssl][:certfile]
    keyfile node[:watcher][:ssl][:keyfile]
Severity: Major
Found in chef/cookbooks/watcher/recipes/server.rb and 7 other locations - About 1 hr to fix
chef/cookbooks/barbican/recipes/api.rb on lines 38..46
chef/cookbooks/cinder/recipes/api.rb on lines 34..42
chef/cookbooks/designate/recipes/api.rb on lines 26..34
chef/cookbooks/glance/recipes/api.rb on lines 30..38
chef/cookbooks/heat/recipes/server.rb on lines 93..101
chef/cookbooks/manila/recipes/common.rb on lines 146..154
chef/cookbooks/neutron/recipes/server.rb on lines 41..49

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

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

Method validate_proposal_after_save has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def validate_proposal_after_save(proposal)
    validate_one_for_role proposal, "manila-server"
    validate_at_least_n_for_role proposal, "manila-share", 1

    proposal["attributes"][@bc_name]["shares"].each do |share|
Severity: Minor
Found in crowbar_framework/app/models/manila_service.rb - About 1 hr to fix

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

  CiscoPorts.prototype.removeJson = function(key, value, type) {
    return $(this.options.storage).removeJsonAttribute(
      '{0}/{1}'.format(
        this.options.path,
        key
crowbar_framework/app/assets/javascripts/barclamps/neutron/application.js on lines 195..204

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

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

  CiscoPorts.prototype.writeJson = function(key, value, type) {
    return $(this.options.storage).writeJsonAttribute(
      '{0}/{1}'.format(
        this.options.path,
        key
crowbar_framework/app/assets/javascripts/barclamps/neutron/application.js on lines 206..215

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

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

Method network_settings has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def network_settings(node)
      ha_enabled = node[:octavia][:ha][:enabled]
      @admin_ip ||= Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "admin").address
      @cluster_admin_ip ||= nil

Severity: Minor
Found in chef/cookbooks/octavia/libraries/helpers.rb - About 1 hr to fix

Method apply_role_pre_chef_call has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def apply_role_pre_chef_call(old_role, role, all_nodes)
    @logger.debug("Cinder apply_role_pre_chef_call: entering #{all_nodes.inspect}")
    return if all_nodes.empty?

    controller_elements, controller_nodes, ha_enabled = role_expand_elements(role, "cinder-controller")
Severity: Minor
Found in crowbar_framework/app/models/cinder_service.rb - About 1 hr to fix

Method create_proposal has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create_proposal
    @logger.debug("Monasca create_proposal: entering")
    base = super

    nodes = NodeObject.all
Severity: Minor
Found in crowbar_framework/app/models/monasca_service.rb - About 1 hr to fix

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

def upgrade(ta, td, a, d)
  d["element_states"] = td["element_states"]
  d["element_order"] = td["element_order"]
  d["element_run_list_order"] = td["element_run_list_order"]

chef/data_bags/crowbar/migrate/nova/111_remove_nova_docker.rb on lines 1..19
chef/data_bags/crowbar/migrate/nova/113_remove_hyperv.rb on lines 1..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 61.

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 upgrade(template_attrs, template_deployment, attrs, deployment)
  deployment["element_states"] = template_deployment["element_states"]
  deployment["element_order"] = template_deployment["element_order"]
  deployment["element_run_list_order"] = template_deployment["element_run_list_order"]

chef/data_bags/crowbar/migrate/nova/302_remove_xen.rb on lines 1..17

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

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