yast/yast-bootloader

View on GitHub

Showing 74 of 74 total issues

File grub2_widgets.rb has 918 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 2 days to fix

    Class Grub2Base has 35 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 4 hrs to fix

      File Bootloader.rb has 330 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

        File grub2base.rb has 322 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require "yast"
        require "yast2/execute"
        require "yast2/target_file" # adds ability to work with cfa in inst-sys
        require "bootloader/bootloader_base"
        require "bootloader/exceptions"
        Severity: Minor
        Found in src/lib/bootloader/grub2base.rb - About 3 hrs to fix

          File proposal_client.rb has 282 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "installation/proposal_client"
          require "bootloader/exceptions"
          require "bootloader/main_dialog"
          require "bootloader/bootloader_factory"
          require "bootloader/systeminfo"
          Severity: Minor
          Found in src/lib/bootloader/proposal_client.rb - About 2 hrs to fix

            Class BootStorageClass has 24 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 DefaultKernelParams has a Cognitive Complexity of 19 (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 Stage1 has 23 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class Stage1
                  extend Forwardable
                  include Yast::Logger
              
                  attr_reader :model
              Severity: Minor
              Found in src/lib/bootloader/stage1.rb - About 2 hrs to fix

                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

                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 Read has 59 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

                  File autoyast_converter.rb has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require "yast"
                  
                  require "bootloader/bootloader_factory"
                  require "bootloader/cpu_mitigations"
                  
                  
                  Severity: Minor
                  Found in src/lib/bootloader/autoyast_converter.rb - About 2 hrs to fix

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

                      class Systeminfo
                        class << self
                          # Check current secure boot state.
                          #
                          # This prefers the 'real' state over the config file setting, if possible.
                    Severity: Minor
                    Found in src/lib/bootloader/systeminfo.rb - About 2 hrs to fix

                      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 modify_kernel_params has 42 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 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 Write has 37 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 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

                            Severity
                            Category
                            Status
                            Source
                            Language