crowbar/crowbar-openstack

View on GitHub

Showing 237 of 748 total issues

Method apply_role_pre_chef_call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

    unless hyperv_available?
Severity: Minor
Found in crowbar_framework/app/models/ceilometer_service.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_proposal_after_save(proposal)
    validate_one_for_role proposal, "horizon-server"

    if proposal["attributes"][@bc_name]["multi_domain_support"]
      ks_svc = KeystoneService.new @logger
Severity: Minor
Found in crowbar_framework/app/models/horizon_service.rb - About 35 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 skip_unchanged_node? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def skip_unchanged_node?(node, old_role, new_role)
    # if old_role is nil, then we are applying the barclamp for the first time, so no skip
    return false if old_role.nil?

    # if the node changed roles, then we need to apply, so no skip
Severity: Minor
Found in crowbar_framework/app/models/nova_service.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

  def apply_role_pre_chef_call(_old_role, role, all_nodes)
    @logger.debug("Manila apply_role_pre_chef_call: "\
                  "entering #{all_nodes.inspect}")

    return if all_nodes.empty?
Severity: Minor
Found in crowbar_framework/app/models/manila_service.rb - About 35 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 too many return statements within this method.
Open

        return "mdy"
Severity: Major
Found in chef/cookbooks/postgresql/libraries/default.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

      return false if node_changed_ha?(node, old_role, new_role)
Severity: Major
Found in crowbar_framework/app/models/nova_service.rb - About 30 mins to fix

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

def downgrade(template_attrs, template_deployment, attrs, deployment)
  attrs["mysql"].delete("wsrep_provider_options_custom") unless template_attrs["mysql"].key?("wsrep_provider_options_custom")
  attrs["mysql"].delete("gcs_fc_limit_multiplier") unless template_attrs["mysql"].key?("gcs_fc_limit_multiplier")
  attrs["mysql"].delete("gcs_fc_factor") unless template_attrs["mysql"].key?("gcs_fc_factor")
  return attrs, deployment

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 d["element_states"].key?("neutron-sdn-cisco-aci-agents")
    d["element_states"] = td["element_states"]
    d["element_order"] = td["element_order"]
    d["element_run_list_order"] = td["element_run_list_order"]
Severity: Minor
Found in chef/data_bags/crowbar/migrate/neutron/301_add_cisco_aci_role.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)
  z = a["zvm"]

  unless z.key? "zvm_user_default_password"
    z["zvm_user_default_password"] = ta["zvm"]["zvm_user_default_password"]
Severity: Minor
Found in chef/data_bags/crowbar/migrate/nova/104_add_zvm_extra.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(template_attrs, template_deployment, attrs, deployment)
  attrs["mysql"]["wsrep_provider_options_custom"] = template_attrs["mysql"]["wsrep_provider_options_custom"] unless attrs["mysql"]["wsrep_provider_options_custom"]
  attrs["mysql"]["gcs_fc_limit_multiplier"] = template_attrs["mysql"]["gcs_fc_limit_multiplier"] unless attrs["mysql"]["gcs_fc_limit_multiplier"]
  attrs["mysql"]["gcs_fc_factor"] = template_attrs["mysql"]["gcs_fc_factor"] unless attrs["mysql"]["gcs_fc_factor"]
  return attrs, deployment

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["volume_defaults"]["netapp"].key? "max_over_subscription_ratio"
    a["volume_defaults"]["netapp"]["max_over_subscription_ratio"] = \
      ta["volume_defaults"]["netapp"]["max_over_subscription_ratio"]

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

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

def downgrade(ta, td, a, d)
  z = a["zvm"]

  unless ta["zvm"].key? "zvm_user_default_password"
    z.delete("zvm_user_default_password")
Severity: Minor
Found in chef/data_bags/crowbar/migrate/nova/104_add_zvm_extra.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 create_proposal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create_proposal
    base = super

    nodes = NodeObject.all
    nodes.delete_if { |n| n.nil? or n.admin? }
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 create_ring has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def create_ring
  name = @new_resource.name
  mh = @new_resource.min_part_hours ? @new_resource.min_part_hours : 1
  parts = @new_resource.partitions ? @new_resource.partitions : 18
  replicas = @new_resource.replicas ? @new_resource.replicas : 3
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 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 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 upgrade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def upgrade(ta, td, a, d)
  if a["volume_defaults"]["nfs"].key? "nfs_mount_options"
    a["volume_defaults"]["nfs"].delete("nfs_mount_options")
  end
  a["volumes"].each do |volume|
Severity: Minor
Found in chef/data_bags/crowbar/migrate/cinder/108_remove_nfs_mount_options.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