crowbar/crowbar-openstack

View on GitHub

Showing 237 of 748 total issues

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

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

    server_elements, server_nodes, ha_enabled = role_expand_elements(role, "horizon-server")
Severity: Minor
Found in crowbar_framework/app/models/horizon_service.rb - About 2 hrs 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 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    # prepare extra users
Severity: Major
Found in crowbar_framework/app/models/rabbitmq_service.rb - About 2 hrs to fix

File compute_ha.rb has 258 lines of code (exceeds 250 allowed). Consider refactoring.
Open

remote_nodes = CrowbarPacemakerHelper.remote_nodes(node)
return if remote_nodes.empty?

nova = remote_nodes.first
unless nova.roles.any? { |role| /^nova-compute-/ =~ role }
Severity: Minor
Found in chef/cookbooks/nova/recipes/compute_ha.rb - About 2 hrs to fix

Function ml2_mechanism_drivers_check has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function ml2_mechanism_drivers_check() {
  var values = $('#ml2_mechanism_drivers').val() || [];

  // auto-select openvswitch & vlan if cisco is selected
  if (values.indexOf("cisco_nexus") >= 0) {

Method update_ovs_bridge_attributes has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def update_ovs_bridge_attributes(attributes, node)
    needs_save = false
    ovs_bridge_networks = []
    ml2_mechanism_drivers = []
    if attributes["networking_plugin"] == "ml2"
Severity: Major
Found in crowbar_framework/app/models/neutron_service.rb - About 2 hrs to fix

Method action_create has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

        def action_create
          unless exists?
            begin
              encoding = @new_resource.encoding
              if encoding != "DEFAULT"
Severity: Minor
Found in chef/cookbooks/database/libraries/provider_database_postgresql.rb - About 2 hrs 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 16 (exceeds 5 allowed). Consider refactoring.
Open

  def create_proposal
    @logger.debug("Nova create_proposal: entering")
    base = super
    @logger.debug("Nova create_proposal: done with base")

Severity: Minor
Found in crowbar_framework/app/models/nova_service.rb - About 2 hrs 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 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create_proposal
    @logger.debug("Nova create_proposal: entering")
    base = super
    @logger.debug("Nova create_proposal: done with base")

Severity: Major
Found in crowbar_framework/app/models/nova_service.rb - About 2 hrs to fix

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

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

    server_elements, server_nodes, ha_enabled = role_expand_elements(role, "horizon-server")
Severity: Minor
Found in crowbar_framework/app/models/horizon_service.rb - About 1 hr to fix

Method validate_cisco_aci has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

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

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

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

  def self.database_settings(node, barclamp)
    instance = node[barclamp][:database_instance] || "default"

    # Cache the result for each cookbook in an instance variable hash. This
    # cache needs to be invalidated for each chef-client run from chef-client
Severity: Minor
Found in chef/cookbooks/crowbar-openstack/libraries/helpers.rb - About 1 hr 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 15 (exceeds 5 allowed). Consider refactoring.
Open

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

    controller_elements, controller_nodes, ha_enabled = role_expand_elements(role, "cinder-controller")
Severity: Minor
Found in crowbar_framework/app/models/cinder_service.rb - About 1 hr 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 15 (exceeds 5 allowed). Consider refactoring.
Open

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

    net_svc = NetworkService.new @logger
    network_proposal = Proposal.find_by(barclamp: net_svc.bc_name, name: "default")
Severity: Minor
Found in crowbar_framework/app/models/ironic_service.rb - About 1 hr 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 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    database_elements, database_nodes, database_ha_enabled = role_expand_elements(role, "database-server")
Severity: Minor
Found in crowbar_framework/app/models/database_service.rb - About 1 hr to fix

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

  def validate_proposal_after_save(proposal)
    # first, check for conflict with ceph
    Proposal.where(barclamp: "ceph").each {|p|
      next unless (p.status == "ready") || (p.status == "pending")
      ceph_role = p.role
Severity: Minor
Found in crowbar_framework/app/models/swift_service.rb - About 1 hr to fix

Method database_settings has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.database_settings(node, barclamp)
    instance = node[barclamp][:database_instance] || "default"

    # Cache the result for each cookbook in an instance variable hash. This
    # cache needs to be invalidated for each chef-client run from chef-client
Severity: Minor
Found in chef/cookbooks/crowbar-openstack/libraries/helpers.rb - About 1 hr to fix

Method validate_ha_attributes has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def validate_ha_attributes(attributes, cluster)
    storage_mode = attributes["ha"]["storage"]["mode"]
    role = available_clusters[cluster]

    case attributes["sql_engine"]
Severity: Minor
Found in crowbar_framework/app/models/database_service.rb - About 1 hr to fix

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

  def apply_role_pre_chef_call(old_role, role, all_nodes)
    @logger.debug("Glance 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 to get the actual list of nodes.
Severity: Minor
Found in crowbar_framework/app/models/glance_service.rb - About 1 hr to fix

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

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

    attributes = proposal["attributes"][@bc_name]

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

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

def upgrade ta, td, a, d
  # Old proposals had passwords created in the cookbook, so we need to migrate
  # them in the proposal and in the role. We use a class variable to set the
  # same password in the proposal and in the role.
  unless defined?(@@keystone_db_password)
Severity: Minor
Found in chef/data_bags/crowbar/migrate/keystone/005_generate_db_password.rb - About 1 hr 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