yast/yast-yast2

View on GitHub

Showing 806 of 967 total issues

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

    def PackageDialog(packages, install, message)
      packages = deep_copy(packages)
      Builtins.y2debug("Asking for packages: %1", packages)
      packs = Builtins.filter(packages) do |package|
        install ? !Installed(package) : Installed(package)
Severity: Minor
Found in library/packages/src/include/packages/common.rb - About 1 hr to fix

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

        def RemoveOldAllowedServiceFromZone(old_service_def, zone)
          old_service_def = deep_copy(old_service_def)
          Builtins.y2milestone("Removing: %1 from zone %2", old_service_def, zone)
    
          if Ops.get_list(old_service_def, "tcp_ports", []) != []
    Severity: Minor
    Found in library/network/src/lib/network/susefirewall2.rb - About 1 hr to fix

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

          def PackageDialog(packages, install, message)
            log.info "Asking for packages: #{packages}"
            packs = Builtins.filter(packages) do |package|
              install ? !Installed(package) : Installed(package)
            end
      Severity: Minor
      Found in library/packages/src/modules/Package.rb - About 1 hr to fix

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

            def UpdateProductInfo(update_file, _filename)
              update_file = deep_copy(update_file)
              # merging all 'map <string, any>' type
              Builtins.foreach(["globals", "software", "partitioning", "network"]) do |section|
                sect = ProductFeatures.GetSection(section)
        Severity: Minor
        Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

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

              def getClientTerm(step, def_, former_result)
                step = deep_copy(step)
                def_ = deep_copy(def_)
                former_result = deep_copy(former_result)
                client = getClientName(
          Severity: Minor
          Found in library/control/src/modules/ProductControl.rb - About 1 hr to fix

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

                def StoreWorkflowFile(file_from, file_to)
                  if file_from.nil? || file_from == "" || file_to.nil? || file_to == ""
                    Builtins.y2error("Cannot copy '%1' to '%2'", file_from, file_to)
                    return nil
                  end
            Severity: Minor
            Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

              Method ShutdownAllLocalDHCPClients has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def ShutdownAllLocalDHCPClients
                    pid_directory = "/var/run/"
              
                    dhcp_pidfiles = Convert.convert(
                      WFM.Read(path(".local.dir"), pid_directory),
              Severity: Minor
              Found in library/network/src/modules/Internet.rb - About 1 hr to fix

                Method CheckNewCreatedFiles has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def CheckNewCreatedFiles(files)
                      new_files = created_files(files)
                
                      return true if new_files.empty?
                
                
                Severity: Minor
                Found in library/system/src/modules/FileChanges.rb - About 1 hr to fix

                  Method GetMenuButtonWidget has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def GetMenuButtonWidget(actions, save, mb_label)
                        actions = deep_copy(actions)
                        menubutton = []
                        if save
                          # menubutton entry
                  Severity: Minor
                  Found in library/log/src/modules/LogView.rb - About 1 hr to fix

                    Method parse_node has 32 lines of code (exceeds 25 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

                      Method has_attributes has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def has_attributes(*attributes, scope: nil, cache: false) # rubocop:disable Naming/PredicateName
                              scope_method = scope ? "#{scope}_" : ""
                              enable_modifications_cache if cache
                              define_method "attributes" do
                                attributes
                      Severity: Minor
                      Found in library/network/src/lib/y2firewall/firewalld/relations.rb - About 1 hr to fix

                        Method IsOtherFirewallRunning has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def IsOtherFirewallRunning
                              any_firewall_running = true
                        
                              # grep must return at least blank lines, else it returns 'exit 1' instead of 'exit 0'
                              command = "LANG=C /usr/sbin/iptables -L -n | /usr/bin/grep -v \"^\\(Chain\\|target\\)\""
                        Severity: Minor
                        Found in library/network/src/lib/network/susefirewall.rb - About 1 hr to fix

                          Method RemoveWorkflow has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def RemoveWorkflow(type, src_id, name)
                                Builtins.y2milestone(
                                  "Removing Workflow:  Type %1, ID %2, Name %3",
                                  type,
                                  src_id,
                          Severity: Minor
                          Found in library/control/src/modules/WorkflowManager.rb - About 1 hr to fix

                            Method Import has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def Import(settings)
                                  settings = deep_copy(settings)
                                  @message_settings = Ops.get_map(settings, "messages", {})
                                  @error_settings = Ops.get_map(settings, "errors", {})
                                  @warning_settings = Ops.get_map(settings, "warnings", {})
                            Severity: Minor
                            Found in library/general/src/modules/Report.rb - About 1 hr to fix

                              Method run has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def run
                                    func, param = Yast::WFM.Args
                                    log.info "Called #{self.class}.run with #{func} and params #{param}"
                              
                                    case func
                              Severity: Minor
                              Found in library/general/src/lib/installation/auto_client.rb - About 1 hr to fix

                                Method ConvertBackAndForth has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def ConvertBackAndForth(strings_in, to_punycode)
                                      # Some (or maybe all) strings needn't be cached
                                      not_cached = []
                                
                                      # Check the cache for already entered strings
                                Severity: Minor
                                Found in library/types/src/modules/Punycode.rb - About 1 hr to fix

                                  Method interface_label has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def interface_label(name)
                                        return name if Mode.config
                                  
                                        label = NetworkInterfaces.GetValue(name, "BOOTPROTO")
                                        ipaddr = NetworkInterfaces.GetValue(name, "IPADDR")
                                  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 ComputePackage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def ComputePackage
                                        packages = GetPackages()
                                        the_kernel = Ops.get(packages, 0, "")
                                        Builtins.y2milestone("Selecting '%1' as kernel package", the_kernel)
                                  
                                  
                                  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 SaveModulesToLoad has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def SaveModulesToLoad
                                        modules_to_load
                                  
                                        unless FileUtils.Exists(MODULES_DIR)
                                          log.warn "Directory #{MODULES_DIR} does not exist, creating"
                                  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 IsServiceSupportedInZone has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def IsServiceSupportedInZone(service, zone)
                                        return nil if !IsKnownZone(zone)
                                  
                                        Yast.import "SuSEFirewallServices" # lazy import due to circular dependencies
                                  
                                  
                                  Severity: Minor
                                  Found in library/network/src/lib/network/susefirewall2.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