yast/yast-yast2

View on GitHub
library/network/src/lib/network/susefirewall2.rb

Summary

Maintainability
F
1 wk
Test Coverage

File susefirewall2.rb has 1754 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yast"
require "network/susefirewall"

module Yast
  # ----------------------------------------------------------------------------
Severity: Major
Found in library/network/src/lib/network/susefirewall2.rb - About 4 days to fix

    Class SuSEFirewall2Class has 85 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class SuSEFirewall2Class < SuSEFirewallClass
        CONFIG_FILE = "/etc/sysconfig/SuSEfirewall2".freeze
    
        include Yast::Logger
    
    
    Severity: Major
    Found in library/network/src/lib/network/susefirewall2.rb - About 1 day to fix

      Method ConvertToServicesDefinedByPackages has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          def ConvertToServicesDefinedByPackages
            return if @already_converted
      
            if FileUtils.Exists(@converted_to_services_dbp_file)
              @already_converted = true
      Severity: Minor
      Found in library/network/src/lib/network/susefirewall2.rb - About 5 hrs 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 main has 126 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def main
            textdomain "base"
      
            Yast.import "Mode"
            Yast.import "Service"
      Severity: Major
      Found in library/network/src/lib/network/susefirewall2.rb - About 5 hrs to fix

        Method ConvertToServicesDefinedByPackages has 102 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def ConvertToServicesDefinedByPackages
              return if @already_converted
        
              if FileUtils.Exists(@converted_to_services_dbp_file)
                @already_converted = true
        Severity: Major
        Found in library/network/src/lib/network/susefirewall2.rb - About 4 hrs to fix

          Method WriteConfiguration has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              def WriteConfiguration
                # just disabled
                return true if !SuSEFirewallIsInstalled()
          
                # Progress only for normal configuration and command line
          Severity: Minor
          Found in library/network/src/lib/network/susefirewall2.rb - About 3 hrs 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 WriteConfiguration has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def WriteConfiguration
                # just disabled
                return true if !SuSEFirewallIsInstalled()
          
                # Progress only for normal configuration and command line
          Severity: Major
          Found in library/network/src/lib/network/susefirewall2.rb - About 2 hrs to fix

            Method IsServiceSupportedInZone has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def IsServiceSupportedInZone(service, zone)
                  return nil if !IsKnownZone(zone)
            
                  Yast.import "SuSEFirewallServices" # lazy import due to circular dependencies
            
            
            Severity: Major
            Found in library/network/src/lib/network/susefirewall2.rb - About 2 hrs to fix

              Method Read has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def Read
                    # Do not read it again and again
                    # to avoid rewriting changes already made
                    if @configuration_has_been_read
                      Builtins.y2milestone(
              Severity: Minor
              Found in library/network/src/lib/network/susefirewall2.rb - About 1 hr to fix

                Method GetAdditionalServices has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def GetAdditionalServices(protocol, zone)
                      if !IsSupportedProtocol(protocol)
                        Builtins.y2error("Unknown protocol '%1'", protocol)
                        return nil
                      end
                Severity: Minor
                Found in library/network/src/lib/network/susefirewall2.rb - About 1 hr to fix

                  Method AddForwardIntoMasqueradeRule has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def AddForwardIntoMasqueradeRule(source_net, forward_to_ip, protocol, req_port, redirect_to_port, requested_ip)
                        SetModified()
                  
                        masquerade_rules = Ops.get_string(@SETTINGS, "FW_FORWARD_MASQ", "")
                  
                  
                  Severity: Minor
                  Found in library/network/src/lib/network/susefirewall2.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 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

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

                          def ActivateConfiguration
                            # just disabled
                            return true if !SuSEFirewallIsInstalled()
                      
                            # starting firewall during second stage can cause deadlock in systemd - bnc#798620
                      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

                      Method SetFirewallKernelModules has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def SetFirewallKernelModules(k_modules)
                            k_modules = deep_copy(k_modules)
                            k_modules = Builtins.filter(k_modules) do |one_module|
                              if one_module.nil?
                                Builtins.y2error(
                      Severity: Minor
                      Found in library/network/src/lib/network/susefirewall2.rb - About 1 hr to fix

                        Method GetListOfForwardsIntoMasquerade has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def GetListOfForwardsIntoMasquerade
                              list_of_rules = []
                        
                              Builtins.foreach(
                                Builtins.splitstring(
                        Severity: Minor
                        Found in library/network/src/lib/network/susefirewall2.rb - About 1 hr to fix

                          Method CheckKernelModules has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def CheckKernelModules
                                needs_additional_module = false
                          
                                Builtins.foreach(GetKnownFirewallZones()) do |one_zone|
                                  if Ops.greater_or_equal(
                          Severity: Minor
                          Found in library/network/src/lib/network/susefirewall2.rb - About 1 hr to fix

                            Method AddServiceSupportIntoZone has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def AddServiceSupportIntoZone(service, zone)
                                  Yast.import "SuSEFirewallServices" # lazy import due to circular dependencies
                            
                                  needed = SuSEFirewallServices.GetNeededPortsAndProtocols(service)
                                  # unknown service
                            Severity: Minor
                            Found in library/network/src/lib/network/susefirewall2.rb - About 1 hr to fix

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

                                  def RemoveServiceSupportFromZone(service, zone)
                                    Yast.import "SuSEFirewallServices" # lazy import due to circular dependencies
                              
                                    needed = SuSEFirewallServices.GetNeededPortsAndProtocols(service)
                                    # unknown service
                              Severity: Minor
                              Found in library/network/src/lib/network/susefirewall2.rb - About 1 hr to fix

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

                                    def SetLoggingSettings(rule, state)
                                      SetModified()
                                
                                      case rule
                                      when "ACCEPT"
                                Severity: Minor
                                Found in library/network/src/lib/network/susefirewall2.rb - About 1 hr to fix

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

                                      def IsBroadcastAllowed(needed_ports, zone)
                                        needed_ports = deep_copy(needed_ports)
                                        if Builtins.size(needed_ports) == 0
                                          Builtins.y2warning("Unknown service with no needed ports!")
                                          return nil
                                  Severity: Minor
                                  Found in library/network/src/lib/network/susefirewall2.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 ReadSysconfigSuSEFirewall has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def ReadSysconfigSuSEFirewall(variables)
                                            variables = deep_copy(variables)
                                            Builtins.foreach(variables) do |variable|
                                              value = Convert.to_string(
                                                SCR.Read(Builtins.add(path(".sysconfig.SuSEfirewall2"), variable))
                                      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

                                      Method ActivateConfiguration has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          def ActivateConfiguration
                                            # just disabled
                                            return true if !SuSEFirewallIsInstalled()
                                      
                                            # starting firewall during second stage can cause deadlock in systemd - bnc#798620
                                      Severity: Minor
                                      Found in library/network/src/lib/network/susefirewall2.rb - About 1 hr to fix

                                        Method AddInterfaceIntoZone has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            def AddInterfaceIntoZone(interface, zone)
                                              SetModified()
                                        
                                              current_zone = GetZoneOfInterface(interface)
                                        
                                        
                                        Severity: Minor
                                        Found in library/network/src/lib/network/susefirewall2.rb - About 1 hr to fix

                                          Method GetLoggingSettings has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              def GetLoggingSettings(rule)
                                                ret_val = nil
                                          
                                                case rule
                                                when "ACCEPT"
                                          Severity: Minor
                                          Found in library/network/src/lib/network/susefirewall2.rb - About 55 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 RemoveServiceSupportFromZone has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              def RemoveServiceSupportFromZone(service, zone)
                                                Yast.import "SuSEFirewallServices" # lazy import due to circular dependencies
                                          
                                                needed = SuSEFirewallServices.GetNeededPortsAndProtocols(service)
                                                # unknown service
                                          Severity: Minor
                                          Found in library/network/src/lib/network/susefirewall2.rb - About 55 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 Read has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              def Read
                                                # Do not read it again and again
                                                # to avoid rewriting changes already made
                                                if @configuration_has_been_read
                                                  Builtins.y2milestone(
                                          Severity: Minor
                                          Found in library/network/src/lib/network/susefirewall2.rb - About 45 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 AddForwardIntoMasqueradeRule has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                              def AddForwardIntoMasqueradeRule(source_net, forward_to_ip, protocol, req_port, redirect_to_port, requested_ip)
                                          Severity: Minor
                                          Found in library/network/src/lib/network/susefirewall2.rb - About 45 mins to fix

                                            Method SetServicesForZones has a Cognitive Complexity of 8 (exceeds 5 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 45 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 GetAdditionalServices has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                def GetAdditionalServices(protocol, zone)
                                                  if !IsSupportedProtocol(protocol)
                                                    Builtins.y2error("Unknown protocol '%1'", protocol)
                                                    return nil
                                                  end
                                            Severity: Minor
                                            Found in library/network/src/lib/network/susefirewall2.rb - About 45 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 AddServiceSupportIntoZone has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                def AddServiceSupportIntoZone(service, zone)
                                                  Yast.import "SuSEFirewallServices" # lazy import due to circular dependencies
                                            
                                                  needed = SuSEFirewallServices.GetNeededPortsAndProtocols(service)
                                                  # unknown service
                                            Severity: Minor
                                            Found in library/network/src/lib/network/susefirewall2.rb - About 45 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 SetFirewallKernelModules has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                def SetFirewallKernelModules(k_modules)
                                                  k_modules = deep_copy(k_modules)
                                                  k_modules = Builtins.filter(k_modules) do |one_module|
                                                    if one_module.nil?
                                                      Builtins.y2error(
                                            Severity: Minor
                                            Found in library/network/src/lib/network/susefirewall2.rb - About 45 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 AddForwardIntoMasqueradeRule has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                def AddForwardIntoMasqueradeRule(source_net, forward_to_ip, protocol, req_port, redirect_to_port, requested_ip)
                                                  SetModified()
                                            
                                                  masquerade_rules = Ops.get_string(@SETTINGS, "FW_FORWARD_MASQ", "")
                                            
                                            
                                            Severity: Minor
                                            Found in library/network/src/lib/network/susefirewall2.rb - About 35 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 GetListOfForwardsIntoMasquerade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                def GetListOfForwardsIntoMasquerade
                                                  list_of_rules = []
                                            
                                                  Builtins.foreach(
                                                    Builtins.splitstring(
                                            Severity: Minor
                                            Found in library/network/src/lib/network/susefirewall2.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 AnyRPCServiceInConfiguration has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                def AnyRPCServiceInConfiguration
                                                  ret = false
                                            
                                                  Builtins.foreach(GetKnownFirewallZones()) do |fw_zone|
                                                    fw_rule = Builtins.sformat("FW_SERVICES_%1_RPC", fw_zone)
                                            Severity: Minor
                                            Found in library/network/src/lib/network/susefirewall2.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 RemoveInterfaceFromZone(interface, zone)
                                                  SetModified()
                                            
                                                  Builtins.y2milestone(
                                                    "Removing interface '%1' from '%2' zone.",
                                            Severity: Minor
                                            Found in library/network/src/lib/network/susefirewall2.rb and 1 other location - About 55 mins to fix
                                            library/network/src/lib/network/susefirewall2.rb on lines 1915..1937

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

                                            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 RemoveSpecialInterfaceFromZone(interface, zone)
                                                  SetModified()
                                            
                                                  Builtins.y2milestone(
                                                    "Removing special string '%1' from '%2' zone.",
                                            Severity: Minor
                                            Found in library/network/src/lib/network/susefirewall2.rb and 1 other location - About 55 mins to fix
                                            library/network/src/lib/network/susefirewall2.rb on lines 1135..1157

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

                                            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

                                                  when "ACCEPT"
                                                    case state
                                                    when "ALL"
                                                      Ops.set(@SETTINGS, "FW_LOG_ACCEPT_CRIT", "yes")
                                                      Ops.set(@SETTINGS, "FW_LOG_ACCEPT_ALL", "yes")
                                            Severity: Minor
                                            Found in library/network/src/lib/network/susefirewall2.rb and 1 other location - About 50 mins to fix
                                            library/network/src/lib/network/susefirewall2.rb on lines 2207..2217

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

                                            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

                                                  when "DROP"
                                                    case state
                                                    when "ALL"
                                                      Ops.set(@SETTINGS, "FW_LOG_DROP_CRIT", "yes")
                                                      Ops.set(@SETTINGS, "FW_LOG_DROP_ALL", "yes")
                                            Severity: Minor
                                            Found in library/network/src/lib/network/susefirewall2.rb and 1 other location - About 50 mins to fix
                                            library/network/src/lib/network/susefirewall2.rb on lines 2195..2205

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

                                            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

                                                  Builtins.foreach(needed_ports) do |needed_port|
                                                    # allowed ports don't contain the needed one and also portranges don't
                                                    if !Builtins.contains(
                                                      Ops.get(allowed_ports_divided, "ports", []),
                                                      needed_port
                                            Severity: Minor
                                            Found in library/network/src/lib/network/susefirewall2.rb and 1 other location - About 25 mins to fix
                                            library/network/src/lib/network/susefirewall.rb on lines 836..844

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

                                            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

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

                                                def SetAcceptExpertRules(zone, expert_rules)
                                                  zone = Builtins.toupper(zone)
                                            
                                                  # Check for zone
                                                  if !Builtins.contains(GetKnownFirewallZones(), zone)
                                            Severity: Minor
                                            Found in library/network/src/lib/network/susefirewall2.rb and 1 other location - About 25 mins to fix
                                            library/network/src/lib/network/susefirewalld.rb on lines 1007..1019

                                            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

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

                                                def GetAcceptExpertRules(zone)
                                                  zone = Builtins.toupper(zone)
                                            
                                                  # Check for zone
                                                  if !Builtins.contains(GetKnownFirewallZones(), zone)
                                            Severity: Minor
                                            Found in library/network/src/lib/network/susefirewall2.rb and 1 other location - About 20 mins to fix
                                            library/network/src/lib/network/susefirewalld.rb on lines 990..999

                                            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 GetAllNonDialUpInterfaces
                                                  non_dial_up_interfaces = []
                                                  Builtins.foreach(GetAllKnownInterfaces()) do |interface|
                                                    if Ops.get(interface, "type") != "dial_up"
                                                      non_dial_up_interfaces = Builtins.add(
                                            Severity: Minor
                                            Found in library/network/src/lib/network/susefirewall2.rb and 1 other location - About 20 mins to fix
                                            library/network/src/lib/network/susefirewall2.rb on lines 1116..1127

                                            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 GetAllDialUpInterfaces
                                                  dial_up_interfaces = []
                                                  Builtins.foreach(GetAllKnownInterfaces()) do |interface|
                                                    if Ops.get(interface, "type") == "dial_up"
                                                      dial_up_interfaces = Builtins.add(
                                            Severity: Minor
                                            Found in library/network/src/lib/network/susefirewall2.rb and 1 other location - About 20 mins to fix
                                            library/network/src/lib/network/susefirewall2.rb on lines 1098..1109

                                            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

                                            There are no issues that match your filters.

                                            Category
                                            Status