yast/yast-yast2

View on GitHub
library/wizard/src/modules/Wizard.rb

Summary

Maintainability
F
6 days
Test Coverage

File Wizard.rb has 1103 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yast"

module Yast
  class WizardClass < Module
    DEFAULT_ICON_NAME = "yast".freeze
Severity: Major
Found in library/wizard/src/modules/Wizard.rb - About 2 days to fix

    Class WizardClass has 92 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class WizardClass < Module
        DEFAULT_ICON_NAME = "yast".freeze
    
        def main
          Yast.import "UI"
    Severity: Major
    Found in library/wizard/src/modules/Wizard.rb - About 1 day to fix

      Method SetContentsFocus has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def SetContentsFocus(title, contents, help_text, has_back, has_next, set_focus)
            contents = deep_copy(contents)
            if UI.WizardCommand(term(:SetDialogHeading, title)) == true
              UI.WizardCommand(term(:SetHelpText, help_text))
              UI.WizardCommand(term(:EnableNextButton, has_next))
      Severity: Minor
      Found in library/wizard/src/modules/Wizard.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 GenericTreeDialog has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def GenericTreeDialog(button_box)
            button_box = deep_copy(button_box)
            VBox(
              Id(:WizardDialog),
              ReplacePoint(Id(:topmenu), Empty()),
      Severity: Minor
      Found in library/wizard/src/modules/Wizard.rb - About 1 hr to fix

        Method BackAbortNextButtonBox has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def BackAbortNextButtonBox
              HBox(
                HWeight(
                  1,
                  ReplacePoint(
        Severity: Minor
        Found in library/wizard/src/modules/Wizard.rb - About 1 hr to fix

          Method BackAbortInstallationNextButtonBox has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def BackAbortInstallationNextButtonBox
                HBox(
                  HWeight(
                    1,
                    ReplacePoint(
          Severity: Minor
          Found in library/wizard/src/modules/Wizard.rb - About 1 hr to fix

            Method RetranslateButtons has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def RetranslateButtons
                  textdomain "base" # Reload translations
                  if UI.WidgetExists(Id(:WizardDialog)) == true # NCurses wizard
                    UI.ChangeWidget(Id(:help), :Label, Label.HelpButton) if UI.WidgetExists(Id(:help))
                    ReplaceButtonBox(
            Severity: Minor
            Found in library/wizard/src/modules/Wizard.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 GenericDialog has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def GenericDialog(button_box)
                  button_box = deep_copy(button_box)
                  VBox(
                    Id(:WizardDialog),
                    ReplacePoint(Id(:topmenu), Empty()),
            Severity: Minor
            Found in library/wizard/src/modules/Wizard.rb - About 1 hr to fix

              Method SetContentsFocus has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def SetContentsFocus(title, contents, help_text, has_back, has_next, set_focus)
              Severity: Minor
              Found in library/wizard/src/modules/Wizard.rb - About 45 mins to fix

                Method SetContents has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def SetContents(title, contents, help_text, has_back, has_next)
                Severity: Minor
                Found in library/wizard/src/modules/Wizard.rb - About 35 mins to fix

                  Method SetContentsButtons has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def SetContentsButtons(title, contents, help_text, back_label, next_label)
                  Severity: Minor
                  Found in library/wizard/src/modules/Wizard.rb - About 35 mins to fix

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

                        def ShowReleaseNotesButton(label, id)
                          # has wizard? continue
                          #   otherwise use dedicated ReplacePoint or reuse the back button
                          # show-releasenotes-button failed? continue
                          #   use dedicated ReplacePoint or reuse the back button
                    Severity: Minor
                    Found in library/wizard/src/modules/Wizard.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

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

                        def SetContentsButtons(title, contents, help_text, back_label, next_label)
                          contents = deep_copy(contents)
                          UI.PostponeShortcutCheck
                    
                          RestoreBackButton()
                    Severity: Minor
                    Found in library/wizard/src/modules/Wizard.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

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

                        def CreateTreeInternal(tree, parent)
                          tree = deep_copy(tree)
                          m = Builtins.filter(tree) do |c|
                            Ops.get_string(c, "parent", "") == parent
                          end
                    Severity: Minor
                    Found in library/wizard/src/modules/Wizard.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

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

                        def BackAbortInstallationNextButtonBox
                          HBox(
                            HWeight(
                              1,
                              ReplacePoint(
                    Severity: Major
                    Found in library/wizard/src/modules/Wizard.rb and 1 other location - About 1 hr to fix
                    library/wizard/src/modules/Wizard.rb on lines 95..122

                    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 54.

                    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 BackAbortNextButtonBox
                          HBox(
                            HWeight(
                              1,
                              ReplacePoint(
                    Severity: Major
                    Found in library/wizard/src/modules/Wizard.rb and 1 other location - About 1 hr to fix
                    library/wizard/src/modules/Wizard.rb on lines 131..158

                    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 54.

                    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 SetBackButton(id, label)
                          id = deep_copy(id)
                          if UI.WizardCommand(term(:SetBackButtonLabel, label)) == true
                            UI.WizardCommand(term(:SetBackButtonID, id))
                          elsif UI.WidgetExists(Id(:rep_back))
                    Severity: Minor
                    Found in library/wizard/src/modules/Wizard.rb and 1 other location - About 35 mins to fix
                    library/wizard/src/modules/Wizard.rb on lines 929..941

                    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 34.

                    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 SetAbortButton(id, label)
                          id = deep_copy(id)
                    
                          if UI.WizardCommand(term(:SetAbortButtonLabel, label)) == true
                            UI.WizardCommand(term(:SetAbortButtonID, id))
                    Severity: Minor
                    Found in library/wizard/src/modules/Wizard.rb and 1 other location - About 35 mins to fix
                    library/wizard/src/modules/Wizard.rb on lines 908..919

                    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 34.

                    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 AddMenuEntry(menu, parent_id, title, id)
                          menu = deep_copy(menu)
                          if haveFancyUI
                            UI.WizardCommand(term(:AddMenuEntry, parent_id, title, id))
                          else
                    Severity: Minor
                    Found in library/wizard/src/modules/Wizard.rb and 1 other location - About 25 mins to fix
                    library/wizard/src/modules/Wizard.rb on lines 1649..1662

                    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 29.

                    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 AddSubMenu(menu, parent_id, title, id)
                          menu = deep_copy(menu)
                          if haveFancyUI
                            UI.WizardCommand(term(:AddSubMenu, parent_id, title, id))
                          else
                    Severity: Minor
                    Found in library/wizard/src/modules/Wizard.rb and 1 other location - About 25 mins to fix
                    library/wizard/src/modules/Wizard.rb on lines 1672..1685

                    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 29.

                    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 OpenOKDialog
                          if haveFancyUI
                            open_wizard_dialog(
                              :no_back_button,
                              "",
                    Severity: Minor
                    Found in library/wizard/src/modules/Wizard.rb and 1 other location - About 20 mins to fix
                    library/wizard/src/modules/Wizard.rb on lines 456..474

                    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 27.

                    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 OpenAcceptDialog
                          if haveFancyUI
                            open_wizard_dialog(
                              :no_back_button,
                              "",
                    Severity: Minor
                    Found in library/wizard/src/modules/Wizard.rb and 1 other location - About 20 mins to fix
                    library/wizard/src/modules/Wizard.rb on lines 480..498

                    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 27.

                    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

                              Ops.greater_or_equal(Ops.get_integer(ui_info, "Depth", 0), 15) &&
                              Ops.greater_or_equal(Ops.get_integer(ui_info, "DefaultWidth", 0), 800) &&
                              # some netbooks use such a strange resolution (fate#306298)
                              Ops.greater_or_equal(
                                Ops.get_integer(ui_info, "DefaultHeight", 0),
                    Severity: Minor
                    Found in library/wizard/src/modules/Wizard.rb and 1 other location - About 15 mins to fix
                    library/packages/src/modules/Slides.rb on lines 139..146

                    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 26.

                    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

                    There are no issues that match your filters.

                    Category
                    Status