yast/yast-installation

View on GitHub

Showing 173 of 173 total issues

Method run_clients has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def run_clients(clients, going_back: false)
      result = going_back ? :back : :next
      return result if clients.empty?

      client_to_show = going_back ? clients.size - 1 : 0
Severity: Minor
Found in src/lib/installation/select_system_role.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 main has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def main
      Yast.import "UI"

      # Require here to break dependency cycle (bsc#1070996)
      require "autoinstall/activate_callbacks"
Severity: Minor
Found in src/lib/installation/clients/inst_system_analysis.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 InstFinishClient has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

  class InstFinishClient < Client
    include Yast::Logger

    def main
      textdomain "installation"
Severity: Minor
Found in src/lib/installation/clients/inst_finish.rb - About 2 hrs to fix

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

          def handle_dialog_result(value)
            case value
            when :abort
              return :abort if Yast::Popup.ConfirmAbort(:painless)
    
    
    Severity: Minor
    Found in src/lib/installation/clients/inst_complex_welcome.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 SaveInstSysContent has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def SaveInstSysContent
          if !Stage.initial
            Builtins.y2error(
              "This function can be called in the initial stage only!"
            )
    Severity: Minor
    Found in src/modules/SystemFilesCopy.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 SetOneImageProgress has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def SetOneImageProgress(current_progress)
          current_image = ImageInstallation.GetCurrentImageDetails
          max_progress = Ops.get_integer(current_image, "max_progress", 0)
    
          another_image = false
    Severity: Minor
    Found in src/lib/installation/clients/inst_deploy_image.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 pre_continue_handling has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def pre_continue_handling
          @skip = if Yast::UI.WidgetExists(Id(:skip))
            val = Yast::UI.QueryWidget(Id(:skip), :Value)
            log.info "there is :skip widget with value #{val.inspect}."
            val
    Severity: Minor
    Found in src/lib/installation/proposal_runner.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 clean_unneeded_files has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def clean_unneeded_files(dir)
          top = Pathname.new(dir)
    
          ignored_dirs = IGNORED_DIRS.map { |d| top.join(d) }.select(&:directory?)
          ignored_dirs.each { |d| FileUtils.rm_r(d) }
    Severity: Minor
    Found in src/lib/installation/update_repository.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 keep_only_valid_steps has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def keep_only_valid_steps(stage)
          steps = stage["steps"].map do |s|
            # some steps are called in live installer only
            next nil if s == "" || s.nil?
    
    
    Severity: Minor
    Found in src/lib/installation/clients/inst_finish.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 main has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def main
          Yast.import "UI"
          textdomain "installation"
          Yast.import "Wizard"
          Yast.import "Directory"
    Severity: Minor
    Found in src/lib/installation/clients/inst_welcome.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 CreateLanguagesTranslations has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def CreateLanguagesTranslations
          ret = {}
          all_languages = Language.GetLanguagesMap(false)
          Builtins.foreach(all_languages) do |short, translations|
            translation = nil
    Severity: Minor
    Found in src/lib/installation/clients/inst_release_notes.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 CreateDirectoryIfMissing has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def CreateDirectoryIfMissing(create_directory)
          # path already exists
          if FileUtils.Exists(create_directory)
            # exists as a directory
            if FileUtils.IsDirectory(create_directory)
    Severity: Minor
    Found in src/modules/SystemFilesCopy.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 ShowTextFallbackMessage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def ShowTextFallbackMessage
          if (Installation.text_fallback || Installation.no_x11) &&
              Installation.x11_setup_needed && Arch.x11_setup_needed &&
              !Installation.shown_text_mode_warning
            x11_msg = ""
    Severity: Minor
    Found in src/include/installation/inst_inc_all.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 InitNetworkServices has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def InitNetworkServices
          Builtins.y2milestone("Initializing network services...")
    
          # no settings stored
          if !FileUtils.Exists(Installation.reboot_net_settings)
    Severity: Minor
    Found in src/include/installation/inst_inc_second.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 add_repository has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_repository(repo)
          log.info("Adding update from #{repo.inspect}")
          updates_manager.add_repository(repo.uri)
        rescue ::Installation::UpdatesManager::NotValidRepo
          if repo.user_defined?
    Severity: Minor
    Found in src/lib/installation/clients/inst_update_installer.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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def AdjustDisabledProposals
          if InstData.wizardsteps_disabled_proposals.nil?
            Builtins.y2error("Disabled proposals file not defined")
            return
          end
    Severity: Major
    Found in src/include/installation/inst_inc_second.rb and 1 other location - About 1 hr to fix
    src/include/installation/inst_inc_second.rb on lines 60..96

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 62.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def AdjustDisabledModules
          if InstData.wizardsteps_disabled_modules.nil?
            Builtins.y2error("Disabled modules file not defined")
            return
          end
    Severity: Major
    Found in src/include/installation/inst_inc_second.rb and 1 other location - About 1 hr to fix
    src/include/installation/inst_inc_second.rb on lines 99..135

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 62.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method make_proposals has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def make_proposals(force_reset: false, language_changed: false, callback: proc {})
          clear_proposals
    
          # At first run, all clients will be called
          call_proposals = proposal_names
    Severity: Minor
    Found in src/lib/installation/proposal_store.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 RegisterRepos has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def RegisterRepos(url_list)
          url_list = deep_copy(url_list)
          ret = []
    
          Builtins.foreach(url_list) do |new_url|
    Severity: Minor
    Found in src/lib/installation/clients/inst_extrasources.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 build_dialog has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_dialog
          headline = @store.headline
          change_point = Empty()
    
          if Yast::UI.TextMode()
    Severity: Minor
    Found in src/lib/installation/proposal_runner.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