crowbar/crowbar-openstack

View on GitHub

Showing 237 of 748 total issues

File config.rb has 349 lines of code (exceeds 250 allowed). Consider refactoring.
Open

keystone_settings = KeystoneHelper.keystone_settings(node, :nova)
profiler_settings = KeystoneHelper.profiler_settings(node, @cookbook_name)
is_controller = node["roles"].include?("nova-controller")

my_ip_net = "admin"
Severity: Minor
Found in chef/cookbooks/nova/recipes/config.rb - About 4 hrs to fix

Method action_setup has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

      def action_setup
        if @current_resource.generate_certs
          unless ::File.exist?(@current_resource.certfile) \
            && ::File.exist?(@current_resource.keyfile)

Severity: Minor
Found in chef/cookbooks/crowbar-openstack/libraries/provider_ssl_setup.rb - About 4 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 validate_proposal_after_save has 99 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def validate_proposal_after_save(proposal)
    validate_one_for_role proposal, "nova-controller"

    elements = proposal["deployment"]["nova"]["elements"]
    nodes = Hash.new(0)
Severity: Major
Found in crowbar_framework/app/models/nova_service.rb - About 3 hrs to fix

File proxy.rb has 331 lines of code (exceeds 250 allowed). Consider refactoring.
Open

ses_config = SesHelper.ses_settings

include_recipe "utils"
# Note: we always want to setup rsync, even if we do not do anything else; this
# will allow the ring-compute node to push the rings.
Severity: Minor
Found in chef/cookbooks/swift/recipes/proxy.rb - About 3 hrs to fix

File application.js has 330 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Copyright 2011-2013, Dell
 * Copyright 2013-2015, SUSE LINUX Products GmbH
 *
 * Licensed under the Apache License, Version 2.0 (the "License");

File server.rb has 330 lines of code (exceeds 250 allowed). Consider refactoring.
Open

hyperv_compute_node = search(:node, "roles:nova-compute-hyperv") || []
use_hyperv = node[:neutron][:networking_plugin] == "ml2" && !hyperv_compute_node.empty?
zvm_compute_node = search(:node, "roles:nova-compute-zvm") || []
use_zvm = node[:neutron][:networking_plugin] == "ml2" && !zvm_compute_node.empty?
use_vmware_dvs = node[:neutron][:networking_plugin] == "ml2" &&
Severity: Minor
Found in chef/cookbooks/neutron/recipes/server.rb - About 3 hrs to fix

Method validate_proposal_after_save has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_proposal_after_save(proposal)
    validate_one_for_role proposal, "manila-server"
    validate_at_least_n_for_role proposal, "manila-share", 1

    proposal["attributes"][@bc_name]["shares"].each do |share|
Severity: Minor
Found in crowbar_framework/app/models/manila_service.rb - About 3 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 a Cognitive Complexity of 27 (exceeds 5 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 3 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 upgrade has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

def upgrade ta, td, a, d
  a["db"] = ta["db"]

  # we use a class variable to set the same password in the proposal and in the
  # role; we also try to import the database password from the node that was
Severity: Minor
Found in chef/data_bags/crowbar/migrate/glance/004_add_db.rb - About 3 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 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    unless hyperv_available?
      role.override_attributes["nova"]["elements"]["nova-compute-hyperv"] = []
Severity: Major
Found in crowbar_framework/app/models/nova_service.rb - About 3 hrs to fix

Method rabbitmq_settings has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.rabbitmq_settings(node, barclamp)
    instance = node[barclamp][:rabbitmq_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: Major
Found in chef/cookbooks/crowbar-openstack/libraries/helpers.rb - About 3 hrs to fix

Function ml2_mechanism_drivers_check has a Cognitive Complexity of 24 (exceeds 5 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) {

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_ha_attributes has a Cognitive Complexity of 24 (exceeds 5 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 3 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 run has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

 def  run(args, options={"ForceArray" => false})
     p = Axlsx::Package.new

     styles = p.workbook.styles
     delta_style = styles.add_style bg_color: DELTA_BG,
Severity: Major
Found in bin/tempest_results_processor.rb - About 3 hrs to fix

File neutron-l3-ha-service.rb has 303 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'yaml'
require 'open3'
require 'logger'

class HAToolLog
Severity: Minor
Found in chef/cookbooks/neutron/files/default/neutron-l3-ha-service.rb - About 3 hrs to fix

Method validate_proposal_after_save has a Cognitive Complexity of 23 (exceeds 5 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 3 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 upgrade has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

def upgrade(ta, td, a, d)
  fields = ["type", "boot", "console", "deploy", "inspect", "management", "power", "raid"]

  # init empty attributes with defaults
  fields.each do |field|

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 22 (exceeds 5 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: Minor
Found in crowbar_framework/app/models/rabbitmq_service.rb - About 3 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 role_constraints has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def role_constraints
      {
        "nova-controller" => {
          "unique" => false,
          "count" => 1,
Severity: Major
Found in crowbar_framework/app/models/nova_service.rb - About 3 hrs to fix

File common_agent.rb has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

neutron = nil
if node.attribute?(:cookbook) and node[:cookbook] == "nova"
  neutrons = node_search_with_cache("roles:neutron-server", node[:nova][:neutron_instance])
  neutron = neutrons.first || raise("Neutron instance '#{node[:nova][:neutron_instance]}' for nova not found")
  nova_compute_ha_enabled = node[:nova][:ha][:compute][:enabled]
Severity: Minor
Found in chef/cookbooks/neutron/recipes/common_agent.rb - About 3 hrs to fix
Severity
Category
Status
Source
Language