crowbar/crowbar-openstack

View on GitHub

Showing 748 of 748 total issues

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

def downgrade(ta, td, a, d)
  unless ta["db"].key? "max_pool_size"
    a["db"].delete "max_pool_size"
  end
  unless ta["db"].key? "min_pool_size"
chef/data_bags/crowbar/migrate/database/201_add_tuning_variables.rb on lines 21..26

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

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 downgrade(ta, td, a, d)
  a["mysql"].delete("innodb_buffer_pool_size") unless ta["mysql"].key? "innodb_buffer_pool_size"
  a["mysql"].delete("max_connections") unless ta["mysql"].key? "max_connections"
  a["mysql"].delete("tmp_table_size") unless ta["mysql"].key? "tmp_table_size"
  a["mysql"].delete("max_heap_table_size") unless ta["mysql"].key? "max_heap_table_size"
chef/data_bags/crowbar/migrate/nova/037_add_sqlalchemy_pool_values.rb on lines 7..20

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

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

def downgrade ta, td, a, d
  if a.key? "ml2_type_drivers"
    if a["ml2_type_drivers"].include? "vlan"
      a["networking_mode"] = "vlan"
    elsif a["ml2_type_drivers"].include? "gre"
Severity: Minor
Found in chef/data_bags/crowbar/migrate/neutron/022_seperate_ml2_drivers.rb - About 1 hr to fix

Method upgrade has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def upgrade(ta, td, a, d)
  a["ha"] = ta["ha"] unless a.key? "ha"

  # Cookbooks expect the 'enabled' flag under high level 'ha' map
  # - only during the upgrade it was moved under 'ha/mysql'
Severity: Minor
Found in chef/data_bags/crowbar/migrate/database/209_merge_db_roles.rb - About 1 hr to fix

Method upgrade has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def upgrade ta, td, a, d
  a["db"] = ta["db"]

  # we use a class variable to set the same password in the proposal and in the
  # role; we also try to import the database password from the node that was
Severity: Minor
Found in chef/data_bags/crowbar/migrate/glance/004_add_db.rb - About 1 hr to fix

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

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

    base["attributes"][@bc_name]["database_instance"] = find_dep_proposal("database", true)
Severity: Minor
Found in crowbar_framework/app/models/ceilometer_service.rb - About 1 hr to fix

Method validate_vxlan has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def validate_vxlan(vxlan_settings)
    if vxlan_settings["vni_start"] < 0 || vxlan_settings["vni_start"] > 16777215
      validation_error I18n.t("barclamp.#{@bc_name}.validation.vxlan_vni_start")
    end
    if vxlan_settings["vni_end"]  < 0 || vxlan_settings["vni_end"] > 16777215
Severity: Minor
Found in crowbar_framework/app/models/neutron_service.rb - About 1 hr to fix

Method action_create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def action_create
          # create
          # new_resource can have password defined or not;
          # search a user
          # if found,
Severity: Minor
Found in chef/cookbooks/database/libraries/provider_database_mysql_user.rb - About 1 hr to fix

Method upgrade has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def upgrade ta, td, a, d
  if a["networking_mode"]
    a["ml2_type_drivers"] = [a["networking_mode"]]
    a["ml2_type_drivers_default_provider_network"] = a["networking_mode"]
    a["ml2_type_drivers_default_tenant_network"] = a["networking_mode"]
Severity: Minor
Found in chef/data_bags/crowbar/migrate/neutron/022_seperate_ml2_drivers.rb - About 1 hr to fix

Method validate_cisco_aci has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def validate_cisco_aci(proposal)
    # Checks for Cisco ACI ml2 driver
    ml2_mechanism_drivers = proposal["attributes"]["neutron"]["ml2_mechanism_drivers"]
    ml2_type_drivers = proposal["attributes"]["neutron"]["ml2_type_drivers"]

Severity: Minor
Found in crowbar_framework/app/models/neutron_service.rb - About 1 hr to fix

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

  def validate_proposal_after_save(proposal)
    validate_one_for_role proposal, "designate-server"
    validate_one_for_role proposal, "designate-worker"

    designate_bc = proposal["attributes"][@bc_name]
Severity: Minor
Found in crowbar_framework/app/models/designate_service.rb - About 1 hr to fix

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

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

    net_svc = NetworkService.new @logger
Severity: Minor
Found in crowbar_framework/app/models/neutron_service.rb - About 1 hr to fix

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

    if (type_drivers.indexOf('vlan') == -1) {
        type_drivers.push('vlan')
        $('#ml2_type_drivers').val(type_drivers).trigger('change');
    }
crowbar_framework/app/assets/javascripts/barclamps/neutron/application.js on lines 354..357

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

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 (type_drivers.indexOf('vlan') == -1) {
        type_drivers.push('vlan');
        $('#ml2_type_drivers').val(type_drivers).trigger('change');
    }
crowbar_framework/app/assets/javascripts/barclamps/neutron/application.js on lines 339..342

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

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 node[:barbican][:ha][:enabled]
  admin_address = Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "admin").address
  bind_host = admin_address
  bind_port = node[:barbican][:ha][:ports][:api]
else
Severity: Minor
Found in chef/cookbooks/barbican/recipes/api.rb and 1 other location - About 1 hr to fix
chef/cookbooks/keystone/recipes/monitor_monasca.rb on lines 22..28

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

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 node[:keystone][:ha][:enabled]
  admin_address = Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "admin").address
  bind_admin_host = admin_address
  bind_admin_port = node[:keystone][:ha][:ports][:admin_port]
else
Severity: Minor
Found in chef/cookbooks/keystone/recipes/monitor_monasca.rb and 1 other location - About 1 hr to fix
chef/cookbooks/barbican/recipes/api.rb on lines 227..233

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

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 upgrade ta, td, a, d
  a["volume_defaults"]["rbd"]["admin_keyring"] = ta["volume_defaults"]["rbd"]["admin_keyring"]
  a["volumes"].each do |volume|
    next if volume["backend_driver"] != "rbd"
    volume["rbd"]["admin_keyring"] = ta["volume_defaults"]["rbd"]["admin_keyring"]
chef/data_bags/crowbar/migrate/cinder/045_add_vmware_cluster_name.rb on lines 1..8
chef/data_bags/crowbar/migrate/cinder/107_add_rbd_flatten_snapshots_from_volume.rb on lines 1..10

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

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 upgrade(ta, td, a, d)
  a["volume_defaults"]["vmware"]["cluster_name"] = ta["volume_defaults"]["vmware"]["cluster_name"]
  a["volumes"].each do |volume|
    next if volume["backend_driver"] != "vmware"
    volume["vmware"]["cluster_name"] = ta["volume_defaults"]["vmware"]["cluster_name"]
chef/data_bags/crowbar/migrate/cinder/034_add_rbd_admin_keyring_path.rb on lines 1..7
chef/data_bags/crowbar/migrate/cinder/107_add_rbd_flatten_snapshots_from_volume.rb on lines 1..10

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

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 upgrade(ta, td, a, d)
  a["volume_defaults"]["rbd"]["flatten_volume_from_snapshot"] = \
    ta["volume_defaults"]["rbd"]["flatten_volume_from_snapshot"]

  a["volumes"].each do |volume|
chef/data_bags/crowbar/migrate/cinder/034_add_rbd_admin_keyring_path.rb on lines 1..7
chef/data_bags/crowbar/migrate/cinder/045_add_vmware_cluster_name.rb on lines 1..8

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

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 compute_deltas has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def compute_deltas
  req_disks = @new_resource.disks
  keyed_req = {}  # for easy lookup, make a map of the requested disks
  cur = @ring_test
  name = @new_resource.name
Severity: Minor
Found in chef/cookbooks/swift/providers/ringfile.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language