crowbar/crowbar-openstack

View on GitHub
chef/cookbooks/nova/libraries/boot_kernel.rb

Summary

Maintainability
B
5 hrs
Test Coverage

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

  def self.set_boot_kernel_grub1(flavor = "default")
    default_boot = 0
    current_default = nil

    # parse grub config, to find boot index for selected flavor
Severity: Minor
Found in chef/cookbooks/nova/libraries/boot_kernel.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 set_boot_kernel_grub2 has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def self.set_boot_kernel_grub2(flavor = "default")
    default_boot = "SLES12"
    grub_env = `grub2-editenv list`
    if grub_env.include?("saved_entry")
      current_default = grub_env.strip.split("=")[1]
Severity: Minor
Found in chef/cookbooks/nova/libraries/boot_kernel.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 set_boot_kernel_and_trigger_reboot has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def self.set_boot_kernel_and_trigger_reboot(node, flavor = "default")
    # only default and xen flavor is supported by this helper right now
    if node[:platform] == "suse" && node[:platform_version].to_f < 12.0
      set_boot_kernel_grub1(flavor)
    else
Severity: Minor
Found in chef/cookbooks/nova/libraries/boot_kernel.rb - About 55 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

There are no issues that match your filters.

Category
Status