yast/yast-yast2

View on GitHub

Showing 806 of 967 total issues

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

        def find_many_at_once(service_names, propmap = UnitPropMap.new)
          return [] if Yast::Stage.initial

          snames = service_names.map { |n| n + UNIT_SUFFIX unless n.end_with?(UNIT_SUFFIX) }
          snames_s = snames.join(" ")
Severity: Minor
Found in library/systemd/src/lib/yast2/systemd/service.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 CutRegexMatch has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def CutRegexMatch(input, regex, glob)
      return "" if input.nil? || input.empty?

      output = input
      if Builtins.regexpmatch(output, regex)
Severity: Minor
Found in library/types/src/modules/String.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 FormatSizeWithPrecision has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def FormatSizeWithPrecision(bytes, precision, omit_zeroes)
      return "" if bytes.nil?

      units = [
        # Byte abbreviated
Severity: Minor
Found in library/types/src/modules/String.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 LogHandle has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def LogHandle(_key, event)
      event = deep_copy(event)
      @param = CWM.GetProcessedWidget
      LogViewCore.Update(Id(:_cwm_log))
      ret = Ops.get(event, "ID")
Severity: Minor
Found in library/log/src/modules/LogView.rb - About 1 hr to fix

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

        def List(devregex)
          ret = []
          if devregex == "" || devregex.nil?
            Builtins.maplist(@Devices) do |_t, d|
              Builtins.maplist(
    Severity: Minor
    Found in library/network/src/modules/NetworkInterfaces.rb - About 1 hr 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 IntegrateWorkflow has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def IntegrateWorkflow(filename)
              Builtins.y2milestone("IntegrateWorkflow %1", filename)
        
              begin
                update_file = XML.XMLToYCPFile(filename)
        Severity: Minor
        Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

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

              def AssertLineValid(file, line)
                if Builtins.haskey(Ops.get_map(file.value, "l", {}), line) &&
                    Ops.get_boolean(file.value, ["l", line, "buildline"], false)
                  delim = Builtins.substring(
                    Ops.get_string(file.value, "delim", " "),
          Severity: Minor
          Found in library/general/src/modules/AsciiFile.rb - About 1 hr to fix

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

                def mergeTables(new, old)
                  new = deep_copy(new)
                  old = deep_copy(old)
                  # make a true map
                  new_m = Builtins.listmap(new) do |e|
            Severity: Minor
            Found in library/general/src/modules/MailAliases.rb - About 1 hr to fix

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

                  def AnyQuestionRichText(headline, richtext, hdim, vdim, yes_button_message, no_button_message, focus)
                    yes_button = PushButton(
                      Id(:ok),
                      if focus == :focus_yes
                        Opt(:default, :key_F10, :okButton)
              Severity: Minor
              Found in library/general/src/modules/Popup.rb - About 1 hr to fix

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

                    def main
                      Yast.import "UI"
                      Yast.import "Label"
                      Yast.import "Popup"
                      Yast.import "Mode"
                Severity: Minor
                Found in doc/examples/popups3.rb - About 1 hr to fix

                  Method MediaChange has 11 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def MediaChange(error_code, error, url, product, current, current_label, wanted, wanted_label, double_sided, devices, current_device)
                  Severity: Major
                  Found in library/packages/src/modules/PackageCallbacks.rb - About 1 hr to fix

                    Method CheckFiles has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def CheckFiles(files)
                          files = deep_copy(files)
                          files = Builtins.filter(files) { |f| FileChanged(f) }
                    
                          return true unless Ops.greater_than(Builtins.size(files), 0)
                    Severity: Minor
                    Found in library/system/src/modules/FileChanges.rb - About 1 hr to fix

                      Method WriteConfiguration has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def WriteConfiguration
                            # just disabled
                            return true if !SuSEFirewallIsInstalled()
                      
                            return false if !GetModified()
                      Severity: Minor
                      Found in library/network/src/lib/network/susefirewalld.rb - About 1 hr to fix

                        Method ReplaceProposalModule has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def ReplaceProposalModule(proposal, old, new)
                              proposal = deep_copy(proposal)
                              new = deep_copy(new)
                              found = false
                        
                        
                        Severity: Minor
                        Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

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

                              def main
                                Yast.import "UI"
                                Yast.import "Pkg"
                          
                                textdomain "base"
                          Severity: Minor
                          Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

                            Method UpdateProgressBar has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def UpdateProgressBar
                                  if Ops.greater_than(@current_step, @steps)
                                    Builtins.y2error(
                                      -2,
                                      "Progress bar has only %1 steps, not %2.",
                            Severity: Minor
                            Found in library/wizard/src/modules/Progress.rb - About 1 hr to fix

                              Method ReadConfig has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def ReadConfig(config)
                                    Builtins.y2debug("config=%1", config)
                                    return {} if config.nil?
                              
                                    ret = {}
                              Severity: Minor
                              Found in library/network/src/modules/NetworkConfig.rb - About 1 hr to fix

                                Method ArePortsOrServicesAllowed has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def ArePortsOrServicesAllowed(needed_ports, protocol, zone, check_for_aliases)
                                      needed_ports = deep_copy(needed_ports)
                                      are_allowed = true
                                
                                      if Ops.less_than(Builtins.size(needed_ports), 1)
                                Severity: Minor
                                Found in library/network/src/lib/network/susefirewall.rb - About 1 hr to fix

                                  Method SetAdditionalServices has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      def SetAdditionalServices(protocol, zone, new_list_services)
                                        new_list_services = deep_copy(new_list_services)
                                        old_list_services = Builtins.toset(GetAdditionalServices(protocol, zone))
                                        new_list_services = Builtins.toset(new_list_services)
                                  
                                  
                                  Severity: Minor
                                  Found in library/network/src/lib/network/susefirewall.rb - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language