yast/yast-bootloader

View on GitHub

Showing 81 of 81 total issues

Method single_click_action has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def single_click_action(option, value)
      bootloader = ::Bootloader::BootloaderFactory.current

      log.info "single_click_action: option #{option}, value #{value.inspect}"

Severity: Minor
Found in src/lib/bootloader/proposal_client.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 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[Systeminfo.efi_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

Consider simplifying this complex logical expression.
Open

      if Arch.i386 || Arch.x86_64 || Arch.aarch64 || Arch.arm || Arch.ppc || Arch.riscv64
        ret = kernel_cmdline
        ret << " resume=#{resume}" unless resume.empty?
        ret << " #{features}" unless features.empty?
        ret << propose_cpu_mitigations
Severity: Major
Found in src/modules/BootArch.rb - About 40 mins to fix

    Method correct_loader_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def correct_loader_type(type)
          return true if type == "none"
    
          # grub2 is sooo cool...
          return true if type == "grub2" && !::Bootloader::Systeminfo.efi_mandatory?
    Severity: Minor
    Found in src/modules/BootSupportCheck.rb - About 35 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 import_kernel_params has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def import_kernel_params(data, default)
            DEFAULT_KERNEL_PARAMS_MAPPING.each do |key, method|
              val = data.global.public_send(key)
              next unless val
    
    
    Severity: Minor
    Found in src/lib/bootloader/autoyast_converter.rb - About 35 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 write has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def write(etc_only: false)
          # super have to called as first as grub install require some config writen in ancestor
          super
    
          device_map.write if (Yast::Arch.x86_64 || Yast::Arch.i386) && !etc_only
    Severity: Minor
    Found in src/lib/bootloader/grub2.rb - About 35 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 load_from_kernel_args has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.load_from_kernel_args(kernel_params)
          console_parameters = kernel_params.parameter("console")
          return nil unless console_parameters
    
          console_parameters = Array(console_parameters)
    Severity: Minor
    Found in src/lib/bootloader/serial_console.rb - About 35 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 export_grub2efi has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def export_grub2efi(res, bootloader)
            GRUB2EFI_BOOLEAN_MAPPING.each do |key, method|
              val = bootloader.public_send(method)
              res[key] = val ? "true" : "false" unless val.nil?
            end
    Severity: Minor
    Found in src/lib/bootloader/autoyast_converter.rb - About 35 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 ask_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def ask_user(param)
          chosen_id = param["chosen_id"]
          result = :next
          log.info "ask user called with #{chosen_id}"
    
    
    Severity: Minor
    Found in src/lib/bootloader/proposal_client.rb - About 35 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 available_locations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def available_locations
          case Yast::Arch.architecture
          when "i386", "x86_64"
            res = [:mbr]
            return res unless can_use_boot?
    Severity: Minor
    Found in src/lib/bootloader/stage1.rb - About 35 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 export_grub2 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def export_grub2(res, bootloader)
            GRUB2_BOOLEAN_MAPPING.each do |key, method|
              val = bootloader.public_send(method)
              res[key] = val ? "true" : "false" unless val.nil?
            end
    Severity: Minor
    Found in src/lib/bootloader/autoyast_converter.rb - About 35 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

    Avoid too many return statements within this method.
    Open

            return false
    Severity: Major
    Found in src/lib/bootloader/kexec.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return false
      Severity: Major
      Found in src/modules/Bootloader.rb - About 30 mins to fix

        Method proper_environment? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def proper_environment?
              if Yast::Mode.live_installation
                log.info "Running live_installation without using kexec"
                return false
              end
        Severity: Minor
        Found in src/lib/bootloader/kexec.rb - About 25 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 bootloader_by_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def bootloader_by_name(name)
                # needed to be able to store settings when moving between bootloaders
                @cached_bootloaders ||= {}
                case name
                when "grub2"
        Severity: Minor
        Found in src/lib/bootloader/bootloader_factory.rb - About 25 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 write has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def write
              log.info "Saving /etc/sysconfig/bootloader for #{bootloader}"
        
              write_option(:bootloader, bootloader)
        
        
        Severity: Minor
        Found in src/lib/bootloader/sysconfig.rb - About 25 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 summary has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def summary(simple_mode: false)
              result = [
                Yast::Builtins.sformat(
                  _("Boot Loader Type: %1"),
                  "GRUB2"
        Severity: Minor
        Found in src/lib/bootloader/grub2.rb - About 25 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 propose_cpu_mitigations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def propose_cpu_mitigations
              linuxrc_value = Yast::Linuxrc.value_for("mitigations")
              log.info "linuxrc mitigations #{linuxrc_value.inspect}"
              return "" unless linuxrc_value.nil? # linuxrc already has mitigations
        
        
        Severity: Minor
        Found in src/modules/BootArch.rb - About 25 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 import_grub2efi has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def import_grub2efi(data, bootloader)
                return unless bootloader.name == "grub2-efi"
        
                GRUB2EFI_BOOLEAN_MAPPING.each do |key, method|
                  val = data.global.public_send(key)
        Severity: Minor
        Found in src/lib/bootloader/autoyast_converter.rb - About 25 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 propose_terminal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def propose_terminal
              begin
                return if grub_default.terminal
              rescue RuntimeError => e
                log.info "Proposing terminal again due to #{e}"
        Severity: Minor
        Found in src/lib/bootloader/grub2base.rb - About 25 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

        Severity
        Category
        Status
        Source
        Language