yast/yast-bootloader

View on GitHub
src/lib/bootloader/grub_install.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method execute has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def execute(devices: [], secure_boot: false, trusted_boot: false, update_nvram: true)
      if secure_boot && !Systeminfo.secure_boot_available?(@grub2_name)
        # There might be some secure boot setting left over when the
        # bootloader had been switched.
        # Simply ignore it when it is not applicable instead of raising an
Severity: Minor
Found in src/lib/bootloader/grub_install.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 target has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def target
      return @target if @target

      arch = Yast::Arch.architecture
      target = efi ? EFI_TARGETS[arch] : NON_EFI_TARGETS[arch]
Severity: Minor
Found in src/lib/bootloader/grub_install.rb - About 45 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 basic_cmd has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def basic_cmd(secure_boot, trusted_boot, update_nvram)
      if Systeminfo.shim_needed?(@grub2_name, secure_boot)
        cmd = ["/usr/sbin/shim-install", "--config-file=/boot/grub2/grub.cfg"]
      else
        cmd = ["/usr/sbin/grub2-install", "--target=#{target}"]
Severity: Minor
Found in src/lib/bootloader/grub_install.rb - About 45 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