yast/yast-yast2

View on GitHub

Showing 806 of 967 total issues

Method initialize has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def initialize(systemd_unit, property_text)
        super()
        self[:systemd_unit] = systemd_unit
        if property_text.nil?
          raw_output   = load_systemd_properties
Severity: Minor
Found in library/systemd/src/lib/yast2/systemd/unit_properties.rb - About 1 hr to fix

    Method FormatSimpleType has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def FormatSimpleType(variable, indent)
          variable = deep_copy(variable)
          if Ops.is_void?(variable)
            Builtins.sformat("%2%1 (void)", variable, indent)
          elsif Ops.is_boolean?(variable)
    Severity: Minor
    Found in library/general/src/modules/ValueBrowser.rb - About 1 hr to fix

      Method Initialize has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def Initialize
            @_mode = "normal"
            @_test = "none"
            arg_count = Builtins.size(WFM.Args)
            arg_no = 0
      Severity: Minor
      Found in library/general/src/modules/Mode.rb - About 1 hr to fix

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

            def main
              Yast.import "UI"
              Yast.import "LogViewCore"
        
              @file = "/var/log/messages"
        Severity: Minor
        Found in library/log/examples/logviewcore2.rb - About 1 hr to fix

          Method GetTypeFromSysfs has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def GetTypeFromSysfs(dev)
                sys_dir_path = Builtins.sformat("/sys/class/net/%1", dev)
                sys_type_path = Builtins.sformat("%1/type", sys_dir_path)
          
                return nil if IsEmpty(dev) || !FileUtils.Exists(sys_type_path)
          Severity: Minor
          Found in library/network/src/modules/NetworkInterfaces.rb - About 1 hr to fix

            Method CreateNewPortRange has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def CreateNewPortRange(min_pr, max_pr)
                  if min_pr.nil? || min_pr == 0
                    Builtins.y2error(
                      "Wrong definition of the starting port '%1', it must be between 1 and 65535",
                      min_pr
            Severity: Minor
            Found in library/network/src/modules/PortRanges.rb - About 1 hr to fix

              Method SetServicesForZones has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def SetServicesForZones(services_ids, firewall_zones, new_status)
                    # setting for each service
                    Builtins.foreach(services_ids) do |service_id|
                      Builtins.foreach(firewall_zones) do |firewall_zone|
                        # zone must be known one
              Severity: Minor
              Found in library/network/src/lib/network/susefirewall2.rb - About 1 hr to fix

                Method StartScanDb has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def StartScanDb
                      Builtins.y2milestone("Scanning RPM DB...")
                
                      if Mode.commandline
                        # progress message (command line mode)
                Severity: Minor
                Found in library/packages/src/modules/PackageCallbacks.rb - About 1 hr to fix

                  Method control_file has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def control_file(source)
                        package = case source
                        when ::Integer
                          product = find_product(source)
                          return nil unless product&.product_package
                  Severity: Minor
                  Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

                    Method PrepareWorkflows has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def PrepareWorkflows(workflows)
                          workflows = deep_copy(workflows)
                          new_workflows = []
                    
                          # Going through all workflows
                    Severity: Minor
                    Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

                      Method Launch has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def Launch(modul)
                            function = Ops.get_string(@Modules, [modul, "X-SuSE-YaST-Call"], "")
                            argument = Ops.get_string(@Modules, [modul, "X-SuSE-YaST-Argument"], "")
                            Builtins.y2debug("Calling: %1 (%2)", function, argument)
                      
                      
                      Severity: Minor
                      Found in library/desktop/src/clients/menu.rb - About 1 hr to fix

                        Method load_file_locale has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def load_file_locale(patterns, file_path, language)
                              patterns = deep_copy(patterns)
                              i = 0
                              while Ops.less_than(i, Builtins.size(patterns))
                                p = Ops.get(patterns, i, "")
                        Severity: Minor
                        Found in library/general/src/modules/CustomDialogs.rb - About 1 hr to fix

                          Method DebugBrowseHelper has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def DebugBrowseHelper(variable, indent)
                                variable = deep_copy(variable)
                                simple = FormatSimpleType(variable, indent)
                                if !simple.nil?
                                  Builtins.y2debug("%1", simple)
                          Severity: Minor
                          Found in library/general/src/modules/ValueBrowser.rb - About 1 hr to fix

                            Method MkTempInternal has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def MkTempInternal(template, usergroup, modes, directory)
                                  mktemp = Builtins.sformat(
                                    "/bin/mktemp %1 %2",
                                    directory ? "-d" : "",
                                    template.shellescape
                            Severity: Minor
                            Found in library/general/src/modules/FileUtils.rb - About 1 hr to fix

                              Method Check4 has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def Check4(netmask)
                                    return false if netmask.nil? || netmask == ""
                              
                                    # 255.255.240.0
                                    s1 = "(128|192|224|240|248|252|254|255)"
                              Severity: Minor
                              Found in library/types/src/modules/Netmask.rb - About 1 hr to fix

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

                                    def zone_services(services)
                                      services_status = {}
                                
                                      services.each do |service|
                                        service_supported = firewalld.current_service_names.include?(service)
                                Severity: Minor
                                Found in library/network/src/modules/CWMFirewallInterfaces.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 HidePasswords has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def HidePasswords(in_)
                                      ret = ""
                                
                                      if in_.nil?
                                        ret = nil
                                Severity: Minor
                                Found in library/system/src/modules/Kernel.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 read_modules_to_load has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def read_modules_to_load
                                      @modules_to_load = { MODULES_CONF_FILE => [] }
                                
                                      if FileUtils.Exists(MODULES_DIR)
                                        config_files = SCR::Read(path(".target.dir"), MODULES_DIR)
                                Severity: Minor
                                Found in library/system/src/modules/Kernel.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 CreateKey has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def CreateKey
                                      command = Ops.add("GPG_AGENT_INFO='' ", buildGPGcommand("--gen-key"))
                                      text_mode = Ops.get_boolean(UI.GetDisplayInfo, "TextMode", false)
                                
                                      Builtins.y2debug("text_mode: %1", text_mode)
                                Severity: Minor
                                Found in library/gpg/src/modules/GPG.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 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

                                Severity
                                Category
                                Status
                                Source
                                Language