yast/yast-yast2

View on GitHub
library/packages/src/modules/PackageSystem.rb

Summary

Maintainability
D
1 day
Test Coverage

Method DoInstallAndRemoveInt has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def DoInstallAndRemoveInt(toinstall, toremove)
      toinstall = deep_copy(toinstall)
      toremove = deep_copy(toremove)
      Builtins.y2debug("toinstall: %1, toremove: %2", toinstall, toremove)
      return false if !PackageLock.Check
Severity: Major
Found in library/packages/src/modules/PackageSystem.rb - About 3 hrs to fix

    Method DoInstallAndRemoveInt has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def DoInstallAndRemoveInt(toinstall, toremove)
          toinstall = deep_copy(toinstall)
          toremove = deep_copy(toremove)
          Builtins.y2debug("toinstall: %1, toremove: %2", toinstall, toremove)
          return false if !PackageLock.Check
    Severity: Minor
    Found in library/packages/src/modules/PackageSystem.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

    File PackageSystem.rb has 290 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "yast"
    require "yast2/execute"
    require "shellwords"
    
    module Yast
    Severity: Minor
    Found in library/packages/src/modules/PackageSystem.rb - About 2 hrs to fix

      Method InstallKernel has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def InstallKernel(kernel_modules)
            kernel_modules = deep_copy(kernel_modules)
            # this function may be responsible for the horrible startup time
            Builtins.y2milestone("want: %1", kernel_modules)
            if kernel_modules == []
      Severity: Minor
      Found in library/packages/src/modules/PackageSystem.rb - About 1 hr to fix

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

            def InstallKernel(kernel_modules)
              kernel_modules = deep_copy(kernel_modules)
              # this function may be responsible for the horrible startup time
              Builtins.y2milestone("want: %1", kernel_modules)
              if kernel_modules == []
        Severity: Minor
        Found in library/packages/src/modules/PackageSystem.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

        Avoid too many return statements within this method.
        Open

              return false if ok != true
        Severity: Major
        Found in library/packages/src/modules/PackageSystem.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return false
          Severity: Major
          Found in library/packages/src/modules/PackageSystem.rb - About 30 mins to fix

            Method SelectPackages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def SelectPackages(toinstall, toremove)
                  toinstall = deep_copy(toinstall)
                  toremove = deep_copy(toremove)
                  ok = true
            
            
            Severity: Minor
            Found in library/packages/src/modules/PackageSystem.rb - About 25 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