crowbar/crowbar-openstack

View on GitHub

Showing 237 of 748 total issues

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

package "keystone" do
  package_name "openstack-keystone" if %w(rhel suse).include?(node[:platform_family])
end

if %w(rhel).include?(node[:platform_family])
Severity: Major
Found in chef/cookbooks/keystone/recipes/server.rb - About 1 day to fix

Method validate_proposal_after_save has a Cognitive Complexity of 59 (exceeds 5 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: Minor
Found in crowbar_framework/app/models/nova_service.rb - About 1 day 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

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

require "open3"

nova = get_instance("roles:nova-controller")
keystone_settings = KeystoneHelper.keystone_settings(nova, "nova")

Severity: Major
Found in chef/cookbooks/tempest/recipes/config.rb - About 1 day to fix

Method rabbitmq_settings has a Cognitive Complexity of 54 (exceeds 5 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: Minor
Found in chef/cookbooks/crowbar-openstack/libraries/helpers.rb - About 1 day 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

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

include_recipe "apache2"
include_recipe "apache2::mod_headers"
include_recipe "apache2::mod_wsgi"
include_recipe "apache2::mod_rewrite"

Severity: Major
Found in chef/cookbooks/horizon/recipes/server.rb - About 1 day to fix

Method upgrade has 195 lines of code (exceeds 25 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|

File default.rb has 478 lines of code (exceeds 250 allowed). Consider refactoring.
Open

default["postgresql"]["enable_pgdg_apt"] = false
default["postgresql"]["server"]["config_change_notify"] = :restart

case node[:platform]
when "debian"
Severity: Minor
Found in chef/cookbooks/postgresql/attributes/default.rb - About 7 hrs to fix

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

  def validate_proposal_after_save(proposal)
    validate_one_for_role proposal, "cinder-controller"
    validate_at_least_n_for_role proposal, "cinder-volume", 1

    volume_names = {}
Severity: Minor
Found in crowbar_framework/app/models/cinder_service.rb - About 7 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 update_ovs_bridge_attributes has a Cognitive Complexity of 45 (exceeds 5 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: Minor
Found in crowbar_framework/app/models/neutron_service.rb - About 6 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

File nova_service.rb has 441 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class NovaService < OpenstackServiceObject
  def initialize(thelogger = nil)
    super(thelogger)
    @bc_name = "nova"
  end
Severity: Minor
Found in crowbar_framework/app/models/nova_service.rb - About 6 hrs to fix

File neutron_service.rb has 436 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "ipaddr"

class NeutronService < OpenstackServiceObject
  def initialize(thelogger = nil)
    super(thelogger)
Severity: Minor
Found in crowbar_framework/app/models/neutron_service.rb - About 6 hrs to fix

Method run has a Cognitive Complexity of 41 (exceeds 5 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: Minor
Found in bin/tempest_results_processor.rb - About 6 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

File register.rb has 427 lines of code (exceeds 250 allowed). Consider refactoring.
Open

action :wakeup do
  count = 0
  error = true
  loop do
    count = count + 1
Severity: Minor
Found in chef/cookbooks/keystone/providers/register.rb - About 6 hrs to fix

Method apply_role_pre_chef_call has a Cognitive Complexity of 34 (exceeds 5 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: Minor
Found in crowbar_framework/app/models/nova_service.rb - About 5 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 scan_available_timezones has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

def scan_available_timezones(tzdir)
    # There should be an /etc/localtime zoneinfo file that is a link to
    # (or a copy of) a timezone data file under tzdir, which should have
    # been installed under the "share" directory by the tzdata package.
    #
Severity: Minor
Found in chef/cookbooks/postgresql/libraries/default.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

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

ha_enabled = node[:heat][:ha][:enabled]

db_settings = fetch_database_settings

include_recipe "database::client"
Severity: Minor
Found in chef/cookbooks/heat/recipes/server.rb - About 4 hrs to fix

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

  def validate_proposal_after_save(proposal)
    validate_one_for_role proposal, "cinder-controller"
    validate_at_least_n_for_role proposal, "cinder-volume", 1

    volume_names = {}
Severity: Major
Found in crowbar_framework/app/models/cinder_service.rb - About 4 hrs to fix

File compute.rb has 355 lines of code (exceeds 250 allowed). Consider refactoring.
Open

include_recipe "nova::neutron"
include_recipe "nova::config"

if %w(rhel suse).include?(node[:platform_family])
  # Start open-iscsi daemon, since nova-compute is going to use it and stumble over the
Severity: Minor
Found in chef/cookbooks/nova/recipes/compute.rb - About 4 hrs to fix

Method upgrade has a Cognitive Complexity of 30 (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.
  service = ServiceObject.new "fake-logger"
Severity: Minor
Found in chef/data_bags/crowbar/migrate/ceilometer/004_generate_secrets.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 a Cognitive Complexity of 30 (exceeds 5 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 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

Severity
Category
Status
Source
Language