crowbar/crowbar-openstack

View on GitHub

Showing 237 of 748 total issues

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

def downgrade(ta, td, a, d)
  unless ta["volume_defaults"]["netapp"].key? "max_over_subscription_ratio"
    a["volume_defaults"]["netapp"].delete("max_over_subscription_ratio")
    a["volumes"].each do |volume|
      next if volume["backend_driver"] != "netapp"

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

  def validate_gre(gre_settings)
    if gre_settings["tunnel_id_start"] < 1 || gre_settings["tunnel_id_start"] > 2147483647
      validation_error I18n.t("barclamp.#{@bc_name}.validation.start_id")
    end
    if gre_settings["tunnel_id_end"]  < 1 || gre_settings["tunnel_id_end"] > 2147483647
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 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)
  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)
  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

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

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

    if old_role
Severity: Minor
Found in crowbar_framework/app/models/octavia_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 check_ha_repo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def check_ha_repo(logger)
        return nil unless Proposal.where(barclamp: "pacemaker")
        return false unless Crowbar::Repository.provided?("ha")

        unless Crowbar::Repository.provided_and_enabled?("ha")
Severity: Minor
Found in crowbar_framework/lib/openstack/upgrade.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 check_ceph_repo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def check_ceph_repo(logger)
        return nil unless Proposal.where(barclamp: "ceph")
        return false unless Crowbar::Repository.provided?("ceph")

        unless Crowbar::Repository.provided_and_enabled?("ceph")
Severity: Minor
Found in crowbar_framework/lib/openstack/upgrade.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 apply_role_pre_chef_call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

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

    # Role can be assigned to clusters, so we need to expand the elements
Severity: Minor
Found in crowbar_framework/app/models/watcher_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

Severity
Category
Status
Source
Language