crowbar/crowbar-openstack

View on GitHub

Showing 748 of 748 total issues

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

template "/etc/influxdb/config.toml" do
  source "influxdb-config.toml.erb"
  owner node[:monasca][:influxdb][:user]
  group node[:monasca][:influxdb][:group]
  mode "0640"
Severity: Minor
Found in chef/cookbooks/monasca/recipes/influxdb.rb and 1 other location - About 25 mins to fix
chef/cookbooks/monasca/recipes/cassandra.rb on lines 28..36

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

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

  when ml2_mech_drivers.include?("linuxbridge")
    neutron_agent = neutron[:neutron][:platform][:lb_agent_name]
    neutron_agent_pkg = neutron[:neutron][:platform][:lb_agent_pkg]
    neutron_agent_ra = neutron[:neutron][:ha][:network]["linuxbridge_ra"]
Severity: Minor
Found in chef/cookbooks/nova/recipes/compute_ha.rb and 1 other location - About 25 mins to fix
chef/cookbooks/nova/recipes/compute_ha.rb on lines 62..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 31.

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

execute "glance-manage db sync" do
  user node[:glance][:user]
  group node[:glance][:group]
  command "glance-manage db sync"
  # We only do the sync the first time, and only if we're not doing HA or if we
Severity: Minor
Found in chef/cookbooks/glance/recipes/api.rb and 1 other location - About 25 mins to fix
chef/cookbooks/glance/recipes/api.rb on lines 198..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 31.

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["postgresql"]["config_pgtune"] = {}
  a["postgresql"]["config_pgtune"]["max_connections"] = a["postgresql"]["config"]["max_connections"]
  a["postgresql"].delete("config")
  return a, d
Severity: Minor
Found in chef/data_bags/crowbar/migrate/database/003_no_pgtune.rb and 1 other location - About 25 mins to fix
chef/data_bags/crowbar/migrate/database/003_no_pgtune.rb on lines 1..5

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

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

template "/etc/cassandra/conf/cassandra.yaml" do
  source "cassandra.yaml.erb"
  owner node[:monasca][:cassandra][:user]
  group node[:monasca][:cassandra][:group]
  mode "0640"
Severity: Minor
Found in chef/cookbooks/monasca/recipes/cassandra.rb and 1 other location - About 25 mins to fix
chef/cookbooks/monasca/recipes/influxdb.rb on lines 27..35

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

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 ta, td, a, d
  a["postgresql"]["config"] = {}
  a["postgresql"]["config"]["max_connections"] = a["postgresql"]["config_pgtune"]["max_connections"]
  a["postgresql"].delete("config_pgtune")
  return a, d
Severity: Minor
Found in chef/data_bags/crowbar/migrate/database/003_no_pgtune.rb and 1 other location - About 25 mins to fix
chef/data_bags/crowbar/migrate/database/003_no_pgtune.rb on lines 8..12

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

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 cinder.length > 0
  cinder = cinder[0]
  cinder_admin_username = cinder[:cinder][:service_user]
  cinder_admin_password = cinder[:cinder][:service_password]
else
Severity: Minor
Found in chef/cookbooks/manila/recipes/common.rb and 1 other location - About 25 mins to fix
chef/cookbooks/manila/recipes/common.rb on lines 81..88

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

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

  pacemaker_primitive metadata_agent_primitive do
    agent neutron[:neutron][:ha][:network][:metadata_ra]
    op neutron[:neutron][:ha][:network][:op]
    action :update
    only_if { CrowbarPacemakerHelper.is_cluster_founder?(node) }
Severity: Minor
Found in chef/cookbooks/nova/recipes/compute_ha.rb and 1 other location - About 25 mins to fix
chef/cookbooks/nova/recipes/compute_ha.rb on lines 148..152

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

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

    protocol keystone_settings["protocol"]
    insecure keystone_settings["insecure"]
    host keystone_settings["internal_url_host"]
    port keystone_settings["admin_port"]
    auth register_auth_hash
Severity: Minor
Found in chef/cookbooks/tempest/recipes/config.rb and 1 other location - About 25 mins to fix
chef/cookbooks/tempest/recipes/config.rb on lines 146..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 31.

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

    protocol keystone_settings["protocol"]
    insecure keystone_settings["insecure"]
    host keystone_settings["internal_url_host"]
    port keystone_settings["admin_port"]
    auth register_auth_hash
Severity: Minor
Found in chef/cookbooks/tempest/recipes/config.rb and 1 other location - About 25 mins to fix
chef/cookbooks/tempest/recipes/config.rb on lines 122..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 31.

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

  def self.get_node(node, role, barclamp, instance)
    result = nil

    if node.roles.include?(role) && \
        node.key?(barclamp) && \
Severity: Minor
Found in chef/cookbooks/crowbar-openstack/libraries/helpers.rb - About 25 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

Method downgrade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def downgrade(template_attrs, template_deployment, attrs, deployment)
  attrs["ldap"].delete("chase_referrals") unless template_attrs["ldap"].key?("chase_referrals")
  unless template_attrs["domain_specific_config"]["ldap_users"]["ldap"].key?("chase_referrals")
    attrs["domain_specific_config"].keys.each do |domain|
      attrs["domain_specific_config"][domain]["ldap"].delete("chase_referrals")

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

Method has_cephfs_internal_cluster? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.has_cephfs_internal_cluster?(node)
    # are we using a crowbar-deployed ceph cluster?
    node[:manila][:shares].each do |share|
      next unless share[:backend_driver] == "cephfs"
      return true if share[:cephfs][:use_crowbar]
Severity: Minor
Found in chef/cookbooks/manila/libraries/helpers.rb - About 25 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

Method scan_ring_desc has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def scan_ring_desc(input)
  ringinfo = RingInfo.new

  # if the current state is :ignore, this is the next state
  ignore_next_state = ""
Severity: Minor
Found in chef/cookbooks/swift/providers/ringfile.rb - About 25 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

Method save_proposal! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def save_proposal!(prop, options = {})
    # Fill in missing defaults for infoblox grid configurations
    if prop.raw_data[:attributes][:neutron][:use_infoblox]
      prop.raw_data[:attributes][:neutron][:infoblox][:grids].each do |grid|
        defaults = prop.raw_data["attributes"]["neutron"]["infoblox"]["grid_defaults"]
Severity: Minor
Found in crowbar_framework/app/models/neutron_service.rb - About 25 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

Method downgrade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def downgrade(tattr, tdep, att, dep)
  att["apic"]["opflex"].each_with_index do |opflex, i|
    unless tattr["apic"]["opflex"][0].key?("integration_bridge")
      att["apic"]["opflex"][i].delete("integration_bridge") if opflex.key?("integration_bridge")
    end

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

Method downgrade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def downgrade(ta, td, a, d)
  unless ta["mysql"].key?("innodb_flush_log_at_trx_commit")
    a["mysql"].delete("innodb_flush_log_at_trx_commit")
  end
  unless ta["mysql"].key?("innodb_buffer_pool_instances")
Severity: Minor
Found in chef/data_bags/crowbar/migrate/database/207_add_more_tuning.rb - About 25 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

Method upgrade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def upgrade(tattr, tdep, att, dep)
  att["apic"]["opflex"].each_with_index do |opflex, i|
    unless opflex.key?("integration_bridge")
      att["apic"]["opflex"][i]["integration_bridge"] =
        tattr["apic"]["opflex"][0]["integration_bridge"]

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

Method upgrade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def upgrade(ta, td, a, d)
  unless a["mysql"]["innodb_flush_log_at_trx_commit"]
    a["mysql"]["innodb_flush_log_at_trx_commit"] = ta["mysql"]["innodb_flush_log_at_trx_commit"]
  end
  unless a["mysql"]["innodb_buffer_pool_instances"]
Severity: Minor
Found in chef/data_bags/crowbar/migrate/database/207_add_more_tuning.rb - About 25 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

Method upgrade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def upgrade ta, td, a, d
  # we use a class variable to set the same key in the proposal and in the
  # role
  unless defined?(@@heat_auth_encryption_key)
    if a["auth_encryption_key"].empty?
Severity: Minor
Found in chef/data_bags/crowbar/migrate/heat/014_fix_auth_encryption_key.rb - About 25 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