yast/yast-bootloader

View on GitHub

Showing 69 of 81 total issues

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

    def Read
      log.info "Reading configuration"
      # run Progress bar
      stages = [
        # progress stage, text in dialog (short, infinitiv)
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 check_activate_partition has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def check_activate_partition
      # activate set
      return true if stage1.activate?

      # there is already activate flag
Severity: Minor
Found in src/modules/BootSupportCheck.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 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 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 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 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 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 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 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 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 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 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 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 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

            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 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