yast/yast-bootloader

View on GitHub

Showing 55 of 55 total issues

File grub2_widgets.rb has 779 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yast"

require "bootloader/generic_widgets"
require "bootloader/device_map_dialog"
require "bootloader/serial_console"
Severity: Major
Found in src/lib/bootloader/grub2_widgets.rb - About 1 day to fix

    File Bootloader.rb has 298 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "yast"
    require "yast2/popup"
    require "bootloader/exceptions"
    require "bootloader/sysconfig"
    require "bootloader/bootloader_factory"
    Severity: Minor
    Found in src/modules/Bootloader.rb - About 3 hrs to fix

      Method DefaultKernelParams has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def DefaultKernelParams(resume)
            features = ProductFeatures.GetStringFeature(
              "globals",
              "additional_kernel_parameters"
            )
      Severity: Minor
      Found in src/modules/BootArch.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

      Class Grub2Base has 25 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Grub2Base < BootloaderBase
          include Yast::Logger
          include Yast::I18n
      
          # @!attribute password
      Severity: Minor
      Found in src/lib/bootloader/grub2base.rb - About 2 hrs to fix

        Class BootStorageClass has 23 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class BootStorageClass < Module
            include Yast::Logger
        
            # Moint point for /boot. If there is not separated /boot, / is used instead.
            # @return [Y2Storage::Filesystem]
        Severity: Minor
        Found in src/modules/BootStorage.rb - About 2 hrs to fix

          Method modify_kernel_params has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def modify_kernel_params(*args)
                ReadOrProposeIfNeeded() # ensure we have data to modify
                current_bl = ::Bootloader::BootloaderFactory.current
                # currently only grub2 bootloader supported
                return :missing unless current_bl.respond_to?(:grub_default)
          Severity: Minor
          Found in src/modules/Bootloader.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 can_use_boot? has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def can_use_boot?
                fs = Yast::BootStorage.boot_filesystem
          
                # no boot assigned
                return false unless fs
          Severity: Minor
          Found in src/lib/bootloader/stage1.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

          Class DeviceMapDialog has 21 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class DeviceMapDialog
              include Yast::UIShortcuts
              include Yast::I18n
          
              def self.run(device_map)
          Severity: Minor
          Found in src/lib/bootloader/device_map_dialog.rb - About 2 hrs to fix

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

                  def import_default(data, default)
                    # import first kernel params as smt can later modify it
                    DEFAULT_KERNEL_PARAMS_MAPPING.each do |key, method|
                      val = data["global"][key]
                      next unless val
            Severity: Minor
            Found in src/lib/bootloader/autoyast_converter.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 Read has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def Read
                  log.info "Reading configuration"
                  # run Progress bar
                  stages = [
                    # progress stage, text in dialog (short, infinitiv)
            Severity: Major
            Found in src/modules/Bootloader.rb - About 2 hrs to fix

              Method modify_kernel_params has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def modify_kernel_params(*args)
                    ReadOrProposeIfNeeded() # ensure we have data to modify
                    current_bl = ::Bootloader::BootloaderFactory.current
                    # currently only grub2 bootloader supported
                    return :missing unless current_bl.respond_to?(:grub_default)
              Severity: Minor
              Found in src/modules/Bootloader.rb - About 1 hr to fix

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

                      def export_default(res, default)
                        DEFAULT_BOOLEAN_MAPPING.each do |key, method|
                          val = default.public_send(method)
                          res[key] = val.enabled? ? "true" : "false" if val.defined?
                        end
                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 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 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 Write has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def Write
                      ReadOrProposeIfNeeded()
                
                      mark_as_changed
                
                
                Severity: Minor
                Found in src/modules/Bootloader.rb - About 1 hr to fix

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

                      def execute(devices: [], secure_boot: false, trusted_boot: false)
                        raise "cannot have secure boot without efi" if secure_boot && !efi
                  
                        cmd = basic_cmd(secure_boot, trusted_boot)
                  
                  
                  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 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 DefaultKernelParams has 28 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 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
                            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 make_proposal_raising has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def make_proposal_raising(attrs)
                          if Yast::BootStorage.boot_filesystem.is?(:nfs)
                            ::Bootloader::BootloaderFactory.current_name = "none"
                            return construct_proposal_map
                          end
                    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

                    Severity
                    Category
                    Status
                    Source
                    Language