yast/yast-yast2

View on GitHub
library/system/src/modules/Kernel.rb

Summary

Maintainability
F
3 days
Test Coverage

Method ProbeKernel has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    def ProbeKernel
      kernel_desktop_exists = ((Mode.normal || Mode.repair) &&
        Pkg.PkgInstalled("kernel-desktop")) ||
        Pkg.PkgAvailable("kernel-desktop")
      Builtins.y2milestone(
Severity: Minor
Found in library/system/src/modules/Kernel.rb - About 6 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

File Kernel.rb has 451 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yast"

module Yast
  class KernelClass < Module
    include Yast::Logger
Severity: Minor
Found in library/system/src/modules/Kernel.rb - About 6 hrs to fix

    Class KernelClass has 30 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class KernelClass < Module
        include Yast::Logger
    
        # default configuration file for Kernel modules loaded on boot
        MODULES_CONF_FILE = "yast.conf".freeze
    Severity: Minor
    Found in library/system/src/modules/Kernel.rb - About 3 hrs to fix

      Method ProbeKernel has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def ProbeKernel
            kernel_desktop_exists = ((Mode.normal || Mode.repair) &&
              Pkg.PkgInstalled("kernel-desktop")) ||
              Pkg.PkgAvailable("kernel-desktop")
            Builtins.y2milestone(
      Severity: Major
      Found in library/system/src/modules/Kernel.rb - About 3 hrs to fix

        Method ExtractCmdlineParameters has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def ExtractCmdlineParameters(line)
              return unless line
        
              # list of parameters to be discarded (yast internals)
              cmdlist = list_of_params(line)
        Severity: Minor
        Found in library/system/src/modules/Kernel.rb - About 3 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 ComputePackage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def ComputePackage
              packages = GetPackages()
              the_kernel = Ops.get(packages, 0, "")
              Builtins.y2milestone("Selecting '%1' as kernel package", the_kernel)
        
        
        Severity: Minor
        Found in library/system/src/modules/Kernel.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 SaveModulesToLoad has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def SaveModulesToLoad
              modules_to_load
        
              unless FileUtils.Exists(MODULES_DIR)
                log.warn "Directory #{MODULES_DIR} does not exist, creating"
        Severity: Minor
        Found in library/system/src/modules/Kernel.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_modules_to_load has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def read_modules_to_load
              @modules_to_load = { MODULES_CONF_FILE => [] }
        
              if FileUtils.Exists(MODULES_DIR)
                config_files = SCR::Read(path(".target.dir"), MODULES_DIR)
        Severity: Minor
        Found in library/system/src/modules/Kernel.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 HidePasswords has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def HidePasswords(in_)
              ret = ""
        
              if in_.nil?
                ret = nil
        Severity: Minor
        Found in library/system/src/modules/Kernel.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 ComputePackage has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def ComputePackage
              packages = GetPackages()
              the_kernel = Ops.get(packages, 0, "")
              Builtins.y2milestone("Selecting '%1' as kernel package", the_kernel)
        
        
        Severity: Minor
        Found in library/system/src/modules/Kernel.rb - About 1 hr to fix

          Method main has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def main
                Yast.import "Pkg"
          
                Yast.import "Arch"
                Yast.import "Mode"
          Severity: Minor
          Found in library/system/src/modules/Kernel.rb - About 1 hr to fix

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

                def list_of_params(line)
                  line = line.delete("\n")
                  cmdlist = []
                  parse_index = 0
                  in_quotes = false
            Severity: Minor
            Found in library/system/src/modules/Kernel.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

            There are no issues that match your filters.

            Category
            Status