crowbar/crowbar-openstack

View on GitHub

Showing 748 of 748 total issues

Method downgrade has a Cognitive Complexity of 8 (exceeds 5 allowed). 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"
Severity: Minor
Found in chef/data_bags/crowbar/migrate/database/201_add_tuning_variables.rb - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
Open

def downgrade(ta, td, a, d)
  if ta.key?("ovs") && a.key?("ovs")
    unless ta["ovs"].key?("of_interface")
      a["ovs"].delete("of_interface")
    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 retry_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def retry_request(method, path, body, headers = {}, times = nil)
      headers = @headers.merge(headers)
      resp = nil
      (times || 10).times do |count|
        resp = @http.send_request(method, path, body ? JSON.generate(body) : nil, headers)
Severity: Minor
Found in chef/cookbooks/keystone/libraries/helpers.rb - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
Open

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

Severity: Minor
Found in chef/data_bags/crowbar/migrate/database/201_add_tuning_variables.rb - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
Open

def upgrade(ta, td, a, d)
  unless a.key? "nova_instance"
    a["nova_instance"] = ta["nova_instance"]
  end
  unless a.key? "cinder_instance"
Severity: Minor
Found in chef/data_bags/crowbar/migrate/manila/013_add_dependencies.rb - About 45 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 get_neutron_physnets has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def self.get_neutron_physnets(node, external_networks)
    # This assumes that "nova_fixed" will always be on the physnet called
    # "physnet1" in neutron.
    # Also we don't allow to put 2 external networks on the same neutron
    # physnet.
Severity: Minor
Found in chef/cookbooks/neutron/libraries/helpers.rb - About 45 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

Avoid deeply nested control flow statements.
Open

                        if validate_zone(tzname)
                            if (bestzonename.nil? ||
                            tzname.length < bestzonename.length ||
                            (tzname.length == bestzonename.length &&
                                 (tzname <=> bestzonename) < 0)
Severity: Major
Found in chef/cookbooks/postgresql/libraries/default.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if node[:kernel][:machine] =~ /aarch64|x86_64/
              package "qemu-block-rbd"
            end
Severity: Major
Found in chef/cookbooks/nova/recipes/compute.rb - About 45 mins to fix

Method downgrade has a Cognitive Complexity of 8 (exceeds 5 allowed). 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"
Severity: Minor
Found in chef/data_bags/crowbar/migrate/nova/037_add_sqlalchemy_pool_values.rb - About 45 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 action_create has a Cognitive Complexity of 8 (exceeds 5 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 45 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 validate_proposal_after_save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_proposal_after_save(proposal)
    validate_one_for_role proposal, "ceilometer-central"
    validate_one_for_role proposal, "ceilometer-server"

    # unless (proposal["deployment"]["ceilometer"]["elements"]["ceilometer-agent-hyperv"] || []).empty? || hyperv_available?
Severity: Minor
Found in crowbar_framework/app/models/ceilometer_service.rb - About 45 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 apply_role_pre_chef_call has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def apply_role_pre_chef_call(old_role, role, all_nodes)
    @logger.debug("Keystone apply_role_pre_chef_call: entering #{all_nodes.inspect}")

    server_elements, server_nodes, ha_enabled = role_expand_elements(role, "keystone-server")

Severity: Minor
Found in crowbar_framework/app/models/keystone_service.rb - About 45 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

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

database_user "create manila database user" do
  host "%"
  connection db_settings[:connection]
  username node[:manila][:db][:user]
  password node[:manila][:db][:password]
Severity: Major
Found in chef/cookbooks/manila/recipes/sql.rb and 7 other locations - About 45 mins to fix
chef/cookbooks/ceilometer/recipes/server.rb on lines 50..57
chef/cookbooks/cinder/recipes/sql.rb on lines 41..48
chef/cookbooks/designate/recipes/sql.rb on lines 37..44
chef/cookbooks/glance/recipes/common.rb on lines 43..50
chef/cookbooks/heat/recipes/server.rb on lines 35..42
chef/cookbooks/sahara/recipes/sql.rb on lines 37..44
chef/cookbooks/watcher/recipes/common.rb on lines 42..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 40.

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

database_user "create sahara database user" do
  host "%"
  connection db_settings[:connection]
  username node[:sahara][:db][:user]
  password node[:sahara][:db][:password]
Severity: Major
Found in chef/cookbooks/sahara/recipes/sql.rb and 7 other locations - About 45 mins to fix
chef/cookbooks/ceilometer/recipes/server.rb on lines 50..57
chef/cookbooks/cinder/recipes/sql.rb on lines 41..48
chef/cookbooks/designate/recipes/sql.rb on lines 37..44
chef/cookbooks/glance/recipes/common.rb on lines 43..50
chef/cookbooks/heat/recipes/server.rb on lines 35..42
chef/cookbooks/manila/recipes/sql.rb on lines 24..31
chef/cookbooks/watcher/recipes/common.rb on lines 42..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 40.

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

database_user "create designate database user" do
  host "%"
  connection db_settings[:connection]
  username node[:designate][:db][:user]
  password node[:designate][:db][:password]
Severity: Major
Found in chef/cookbooks/designate/recipes/sql.rb and 7 other locations - About 45 mins to fix
chef/cookbooks/ceilometer/recipes/server.rb on lines 50..57
chef/cookbooks/cinder/recipes/sql.rb on lines 41..48
chef/cookbooks/glance/recipes/common.rb on lines 43..50
chef/cookbooks/heat/recipes/server.rb on lines 35..42
chef/cookbooks/manila/recipes/sql.rb on lines 24..31
chef/cookbooks/sahara/recipes/sql.rb on lines 37..44
chef/cookbooks/watcher/recipes/common.rb on lines 42..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 40.

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

database_user "create glance database user" do
  host "%"
  connection db_settings[:connection]
  username node[:glance][:db][:user]
  password node[:glance][:db][:password]
Severity: Major
Found in chef/cookbooks/glance/recipes/common.rb and 7 other locations - About 45 mins to fix
chef/cookbooks/ceilometer/recipes/server.rb on lines 50..57
chef/cookbooks/cinder/recipes/sql.rb on lines 41..48
chef/cookbooks/designate/recipes/sql.rb on lines 37..44
chef/cookbooks/heat/recipes/server.rb on lines 35..42
chef/cookbooks/manila/recipes/sql.rb on lines 24..31
chef/cookbooks/sahara/recipes/sql.rb on lines 37..44
chef/cookbooks/watcher/recipes/common.rb on lines 42..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 40.

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

database_user "create cinder database user" do
    host "%"
    connection db_settings[:connection]
    username node[:cinder][:db][:user]
    password node[:cinder][:db][:password]
Severity: Major
Found in chef/cookbooks/cinder/recipes/sql.rb and 7 other locations - About 45 mins to fix
chef/cookbooks/ceilometer/recipes/server.rb on lines 50..57
chef/cookbooks/designate/recipes/sql.rb on lines 37..44
chef/cookbooks/glance/recipes/common.rb on lines 43..50
chef/cookbooks/heat/recipes/server.rb on lines 35..42
chef/cookbooks/manila/recipes/sql.rb on lines 24..31
chef/cookbooks/sahara/recipes/sql.rb on lines 37..44
chef/cookbooks/watcher/recipes/common.rb on lines 42..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 40.

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

keystone_register "give ceilometer user access" do
  protocol keystone_settings["protocol"]
  insecure keystone_settings["insecure"]
  host keystone_settings["internal_url_host"]
  port keystone_settings["admin_port"]
Severity: Major
Found in chef/cookbooks/ceilometer/recipes/server.rb and 2 other locations - About 45 mins to fix
chef/cookbooks/ceilometer/recipes/server.rb on lines 150..160
chef/cookbooks/ceilometer/recipes/server.rb on lines 165..175

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

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

keystone_register "grant ceilometer user monasca-user role on monasca projec" do
  protocol keystone_settings["protocol"]
  insecure keystone_settings["insecure"]
  host keystone_settings["internal_url_host"]
  port keystone_settings["admin_port"]
Severity: Major
Found in chef/cookbooks/ceilometer/recipes/server.rb and 2 other locations - About 45 mins to fix
chef/cookbooks/ceilometer/recipes/server.rb on lines 137..147
chef/cookbooks/ceilometer/recipes/server.rb on lines 165..175

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

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

database_user "create heat database user" do
  host "%"
  connection db_settings[:connection]
  username node[:heat][:db][:user]
  password node[:heat][:db][:password]
Severity: Major
Found in chef/cookbooks/heat/recipes/server.rb and 7 other locations - About 45 mins to fix
chef/cookbooks/ceilometer/recipes/server.rb on lines 50..57
chef/cookbooks/cinder/recipes/sql.rb on lines 41..48
chef/cookbooks/designate/recipes/sql.rb on lines 37..44
chef/cookbooks/glance/recipes/common.rb on lines 43..50
chef/cookbooks/manila/recipes/sql.rb on lines 24..31
chef/cookbooks/sahara/recipes/sql.rb on lines 37..44
chef/cookbooks/watcher/recipes/common.rb on lines 42..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 40.

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