yast/yast-yast2

View on GitHub

Showing 806 of 967 total issues

Method MergeWorkflows has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def MergeWorkflows
      Builtins.y2milestone("Merging additional control files from scratch...")
      @unmerged_changes = false

      # Init the Base Workflow settings
Severity: Minor
Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

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

        def main
          # an example client which uses Progress::
    
          Yast.import "Progress"
          Yast.import "Wizard"
    Severity: Minor
    Found in library/wizard/doc/examples/progress_client2.rb - About 1 hr to fix

      Method add_element has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def add_element(doc, metadata, parent, contents, parent_array: nil)
            # backward compatibility. Keys are sorted and needs old ycp sort to be able to compare also classes
            Builtins.sort(contents.keys).each do |key|
              raise XMLSerializationError.new("Cannot represent non-string key '#{key.inspect}', part of #{contents.inspect}", contents) unless key.is_a?(::String)
      
      
      Severity: Minor
      Found in library/xml/src/modules/XML.rb - About 1 hr to fix

        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 updateButtons has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def updateButtons(descr)
                descr = deep_copy(descr)
                Builtins.y2milestone("update buttons")
                id = Convert.to_string(UI.QueryWidget(Id(:_tw_table), :CurrentItem))
                item_list = Convert.convert(
          Severity: Minor
          Found in library/cwm/src/modules/CWMTable.rb - About 1 hr to fix

            Method ValidateValueType has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def ValidateValueType(key, value, widget, popup)
                  value = deep_copy(value)
                  success = true
                  if popup
                    case key
            Severity: Minor
            Found in library/cwm/src/modules/TablePopup.rb - About 1 hr to fix

              Method LazyInit has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def LazyInit
                    # already initialized
                    return if @initialized
              
                    Builtins.y2milestone("Initializing...")
              Severity: Minor
              Found in library/control/src/modules/InstExtensionImage.rb - About 1 hr to fix

                Method SubprogressType has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def SubprogressType(type, max_value)
                      return if !@visible || Mode.commandline
                
                      Builtins.y2debug(
                        "SubprogressType: type: %1, max_value: %2",
                Severity: Minor
                Found in library/wizard/src/modules/Progress.rb - About 1 hr to fix

                  Method PopState has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def PopState
                        # pop the config
                        state = Ops.get(
                          @progress_stack,
                          Ops.subtract(Builtins.size(@progress_stack), 1),
                  Severity: Minor
                  Found in library/wizard/src/modules/Progress.rb - About 1 hr to fix

                    Method OpenSuperior has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def OpenSuperior(title, stages)
                          stages = deep_copy(stages)
                          if UI.HasSpecialWidget(:Wizard)
                            Wizard.OpenAcceptAbortStepsDialog
                            UI.WizardCommand(term(:AddStepHeading, title))
                    Severity: Minor
                    Found in library/wizard/src/modules/Progress.rb - About 1 hr to fix

                      Method UpdateProposal has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def UpdateProposal
                            last_known_interfaces = GetKnownInterfaces()
                            currently_known_interfaces = SuSEFirewall.GetListOfKnownInterfaces
                      
                            had_dialup_interfaces = false
                      Severity: Minor
                      Found in library/network/src/modules/SuSEFirewallProposal.rb - About 1 hr to fix

                        Method IsValidPortRange has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def IsValidPortRange(port_range)
                              # not a port range
                              if !IsPortRange(port_range)
                                warning = Builtins.sformat("Not a port-range %1", port_range)
                                Builtins.y2milestone(warning) if ReportOnlyOnce(warning)
                        Severity: Minor
                        Found in library/network/src/modules/PortRanges.rb - About 1 hr to fix

                          Method UnDisableAllModulesAndProposals has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def UnDisableAllModulesAndProposals(mode, stage)
                                this_workflow = { "mode" => mode, "stage" => stage }
                          
                                # Such mode/stage not disabled
                                if !Builtins.contains(@already_disabled_workflows, this_workflow)
                          Severity: Minor
                          Found in library/control/src/modules/ProductControl.rb - About 1 hr to fix

                            Method UpdateProposals has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def UpdateProposals(proposals, prod_name, domain)
                                  proposals = deep_copy(proposals)
                                  Builtins.foreach(proposals) do |proposal|
                                    name = Ops.get_string(proposal, "name", "")
                                    stage = Ops.get_string(proposal, "stage", "")
                            Severity: Minor
                            Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

                              Method ShowAndRun has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def ShowAndRun(settings)
                                    settings = deep_copy(settings)
                                    if settings["widgets"]
                                      widgets = settings["widgets"]
                                      settings["widget_names"] ||= []
                              Severity: Minor
                              Found in library/cwm/src/modules/CWM.rb - About 1 hr to fix

                                Method ModuleError has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def ModuleError(text)
                                      success = UI.OpenDialog(
                                        Opt(:decorated, :warncolor),
                                        HBox(
                                          HSpacing(1),
                                Severity: Minor
                                Found in library/general/src/modules/Popup.rb - About 1 hr to fix

                                  Method DefaultRunlevel has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      def DefaultRunlevel
                                        target = Convert.to_string(
                                          SCR.Read(path(".target.symlink"), @default_target_symlink)
                                        )
                                        Builtins.y2milestone("Default symlink points to: %1", target)
                                  Severity: Minor
                                  Found in library/systemd/src/modules/Systemd.rb - About 1 hr to fix

                                    Method BrowseTreeHelper has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        def BrowseTreeHelper(variable, indent)
                                          variable = deep_copy(variable)
                                          simple = FormatSimpleType(variable, indent)
                                    
                                          return Item(simple) unless simple.nil?
                                    Severity: Minor
                                    Found in library/general/src/modules/ValueBrowser.rb - About 1 hr to fix

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

                                          def parse_node(node, result)
                                            name = node.name
                                            # use only element children
                                            children = node.children
                                            children = children.select(&:element?)
                                      Severity: Minor
                                      Found in library/xml/src/modules/XML.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 generate_config has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def generate_config(pth, values)
                                            config = {}
                                            values.each do |val|
                                              item = SCR.Read(path("#{pth}.#{val}"))
                                              log.debug("item=#{item}")
                                      Severity: Minor
                                      Found in library/network/src/modules/NetworkInterfaces.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