yast/yast-installation

View on GitHub
src/modules/ImageInstallation.rb

Summary

Maintainability
F
5 days
Test Coverage

File ImageInstallation.rb has 1023 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yast"
require "y2packager/resolvable"

module Yast
  class ImageInstallationClass < Module
Severity: Major
Found in src/modules/ImageInstallation.rb - About 2 days to fix

    Class ImageInstallationClass has 38 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class ImageInstallationClass < Module
        include Yast::Logger
    
        IMAGE_COMPRESS_RATIO = 3.6
        MEGABYTE = 2**20
    Severity: Minor
    Found in src/modules/ImageInstallation.rb - About 5 hrs to fix

      Method DeployTarImage has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          def DeployTarImage(id, target)
            InitRepo()
      
            file = Ops.get_string(@_images, [id, "file"], "")
            Builtins.y2milestone("Untarring image %1 (%2) to %3", id, file, target)
      Severity: Minor
      Found in src/modules/ImageInstallation.rb - About 4 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 FindImageSet has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          def FindImageSet(patterns)
            patterns = deep_copy(patterns)
            InitRepo()
      
            # reset all data
      Severity: Minor
      Found in src/modules/ImageInstallation.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 RestoreAllChanges has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          def RestoreAllChanges
            nr_steps = Ops.multiply(4, Builtins.size(@all_supported_types))
            id = "restoring_user_prefs"
      
            AdjustProgressLayout(id, nr_steps, _("Restoring user preferences..."))
      Severity: Minor
      Found in src/modules/ImageInstallation.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 FileSystemCopy has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def FileSystemCopy(from, to, progress_start, progress_finish)
            total_mb = if from == "/"
              # root is a merge of two filesystems, df returns only one part for /
              calculate_fs_size("/read-write") + calculate_fs_size("/read-only")
            else
      Severity: Minor
      Found in src/modules/ImageInstallation.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 FillUpImagesDetails has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def FillUpImagesDetails
            InitRepo()
      
            # bnc #439104
            if @_repo.nil?
      Severity: Minor
      Found in src/modules/ImageInstallation.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 DeployImages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def DeployImages(images, target, progress)
            images = deep_copy(images)
            progress = deep_copy(progress)
            # unregister callbacks
            PackageCallbacks.RegisterEmptyProgressCallbacks
      Severity: Minor
      Found in src/modules/ImageInstallation.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