yast/yast-bootloader

View on GitHub

Showing 69 of 81 total issues

Method import_default has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def import_default(data, default)
        # import first kernel params as cpu_mitigations can later modify it
        import_kernel_params(data, default)

        DEFAULT_BOOLEAN_MAPPING.each do |key, method|
Severity: Minor
Found in src/lib/bootloader/autoyast_converter.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 basic_cmd has a Cognitive Complexity of 12 (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 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 handle has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def handle
      old_bl = BootloaderFactory.current.name
      new_bl = value

      return nil if old_bl == new_bl
Severity: Minor
Found in src/lib/bootloader/generic_widgets.rb - About 1 hr to fix

    Method controller_loop has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def controller_loop
          loop do
            input = Yast::UI.UserInput
            pos = selected_disk_index
            case input
    Severity: Minor
    Found in src/lib/bootloader/device_map_dialog.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 ReadOrProposeIfNeeded has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def ReadOrProposeIfNeeded
          current_bl = ::Bootloader::BootloaderFactory.current
          return if current_bl.read? || current_bl.proposed?
    
          if Mode.config || (Stage.initial && !Mode.update)
    Severity: Minor
    Found in src/modules/Bootloader.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 controller_loop has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def controller_loop
          loop do
            input = Yast::UI.UserInput
            pos = selected_disk_index
            case input
    Severity: Minor
    Found in src/lib/bootloader/device_map_dialog.rb - About 1 hr to fix

      Method DefaultKernelParams has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def DefaultKernelParams(resume)
            features = ProductFeatures.GetStringFeature(
              "globals",
              "additional_kernel_parameters"
            )
      Severity: Minor
      Found in src/modules/BootArch.rb - About 1 hr to fix

        Method single_click_action has 28 lines of code (exceeds 25 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 1 hr to fix

          Method Write has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def Write
                ReadOrProposeIfNeeded()
          
                mark_as_changed
          
          
          Severity: Minor
          Found in src/modules/Bootloader.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 activate_partitions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def activate_partitions
                partitions_to_activate.each do |partition|
                  num = partition.number
                  disk = partition.partitionable
                  raise "INTERNAL ERROR: Data for partition to activate is invalid." if num.nil? || disk.nil?
          Severity: Minor
          Found in src/lib/bootloader/mbr_update.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 supported_names has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def supported_names
                  if Yast::Mode.config
                    # default means bootloader use what it think is the best
                    result = BootloaderFactory::SUPPORTED_BOOTLOADERS.clone
                    result << SYSTEMDBOOT if use_systemd_boot?
          Severity: Minor
          Found in src/lib/bootloader/bootloader_factory.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 make_proposal_raising has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def make_proposal_raising(attrs)
                force_reset = attrs["force_reset"]
                storage_read = Yast::BootStorage.storage_read?
                # This must be checked at the beginning because the call to BootStorage.boot_filesystem
                # below can trigger a re-read and change the result of BootStorage.storage_changed?
          Severity: Minor
          Found in src/lib/bootloader/proposal_client.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 run_content has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def run_content
                if !Yast::BootStorage.bootloader_installable?
                  textdomain "bootloader"
          
                  # TODO: not much helpful for customers
          Severity: Minor
          Found in src/lib/bootloader/main_dialog.rb - About 1 hr to fix

            Method handle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def handle
                  old_bl = BootloaderFactory.current.name
                  new_bl = value
            
                  return nil if old_bl == new_bl
            Severity: Minor
            Found in src/lib/bootloader/generic_widgets.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

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

                def merge_attributes(default, other)
                  # string attributes
                  [:serial_console, :timeout, :hidden_timeout, :distributor,
                   :gfxmode, :theme, :default].each do |attr|
                    val = other.public_send(attr)
            Severity: Minor
            Found in src/lib/bootloader/grub2base.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 import_timeout has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def import_timeout(data, default)
                    return unless data.global.timeout
            
                    global = data.global
                    if global.hiddenmenu == "true"
            Severity: Minor
            Found in src/lib/bootloader/autoyast_converter.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 handle_buttons has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def handle_buttons(action, pos)
                  case action
                  when :up
                    disks.insert(pos - 1, disks.delete_at(pos))
                    pos -= 1
            Severity: Minor
            Found in src/lib/bootloader/device_map_dialog.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 set_boot_msg has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def set_boot_msg
                  finish_ret = {}
            
                  if Yast::Arch.s390
                    reipl_client = "reipl_bootloader_finish"
            Severity: Minor
            Found in src/lib/bootloader/finish_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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def run
                  guarded_run
                rescue ::Bootloader::NoRoot
                  Yast::Report.Error(
                    _("YaST cannot configure the bootloader because it failed to find the root file system.")
            Severity: Minor
            Found in src/lib/bootloader/config_dialog.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 write has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def write
                  # message after first round of packet installation
                  # now the installed system is run and more packages installed
                  # just warn the user that the screen is going back to text mode
                  # and yast2 will come up again.
            Severity: Minor
            Found in src/lib/bootloader/finish_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

            Severity
            Category
            Status
            Source
            Language