yast/yast-network

View on GitHub

Showing 215 of 253 total issues

File Lan.rb has 585 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yast"
require "cfa/sysctl_config"
require "network/network_autoyast"
require "network/confirm_virt_proposal"
require "ui/text_helpers"
Severity: Major
Found in src/modules/Lan.rb - About 1 day to fix

    Method HostsMainDialog has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

        def HostsMainDialog(standalone)
          # Hosts dialog caption
          caption = _("Host Configuration")
    
          # Hosts dialog help 1/2
    Severity: Minor
    Found in src/include/network/services/host.rb - About 1 day 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

    File routines.rb has 517 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "shellwords"
    
    module Yast
      module NetworkRoutinesInclude
        include I18n
    Severity: Major
    Found in src/include/network/routines.rb - About 1 day to fix

      File dns.rb has 461 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Yast
        module NetworkServicesDnsInclude
          # CWM wants id-value pairs
          CUSTOM_RESOLV_POLICIES = {
            "STATIC"          => "STATIC",
      Severity: Minor
      Found in src/include/network/services/dns.rb - About 7 hrs to fix

        Method initialize_network_services_dns has 172 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def initialize_network_services_dns(include_target)
              textdomain "network"
        
              Yast.import "CWM"
              Yast.import "DNS"
        Severity: Major
        Found in src/include/network/services/dns.rb - About 6 hrs to fix

          Class InterfaceConfigBuilder has 46 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class InterfaceConfigBuilder
              include Yast::Logger
              extend Forwardable
          
              # Load fresh instance of interface config builder for given type.
          Severity: Minor
          Found in src/lib/y2network/interface_config_builder.rb - About 6 hrs to fix

            Method ReadHardware has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
            Open

                def ReadHardware(hwtype)
                  hardware = []
            
                  Builtins.y2debug("hwtype=%1", hwtype)
            
            
            Severity: Minor
            Found in src/include/network/routines.rb - About 6 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 HostsMainDialog has 151 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def HostsMainDialog(standalone)
                  # Hosts dialog caption
                  caption = _("Host Configuration")
            
                  # Hosts dialog help 1/2
            Severity: Major
            Found in src/include/network/services/host.rb - About 6 hrs to fix

              Method initialize_network_lan_help has 148 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def initialize_network_lan_help(_include_target)
                    textdomain "network"
              
                    @help = {
                      "read"              => # Network cards read dialog help 1/2
              Severity: Major
              Found in src/include/network/lan/help.rb - About 5 hrs to fix

                Method Read has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                Open

                    def Read(cache)
                      if cache == :cache && @initialized
                        Builtins.y2milestone("Using cached data")
                        return true
                      end
                Severity: Minor
                Found in src/modules/Lan.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 142 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def main
                      Yast.import "UI"
                
                      # **
                      # <h3>Network configuration</h3>
                Severity: Major
                Found in src/clients/lan.rb - About 5 hrs to fix

                  Method ReadHardware has 139 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def ReadHardware(hwtype)
                        hardware = []
                  
                        Builtins.y2debug("hwtype=%1", hwtype)
                  
                  
                  Severity: Major
                  Found in src/include/network/routines.rb - About 5 hrs to fix

                    Method ControllerType has 124 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def ControllerType(hwdevice)
                          hwdevice = deep_copy(hwdevice)
                          return "modem" if Ops.get_string(hwdevice, "subclass", "") == "Modem"
                          return "isdn" if Ops.get_string(hwdevice, "subclass", "") == "ISDN"
                          return "dsl" if Ops.get_string(hwdevice, "subclass", "") == "DSL"
                    Severity: Major
                    Found in src/include/network/routines.rb - About 4 hrs to fix

                      Class LanClass has 35 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                        class LanClass < Module
                          include ::UI::TextHelpers
                          include Wicked
                      
                          def main
                      Severity: Minor
                      Found in src/modules/Lan.rb - About 4 hrs to fix

                        Method text has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def text
                                interface = @config.interfaces.by_name(@name)
                                hardware = interface ? interface.hardware : nil
                                descr = hardware ? hardware.description : ""
                        
                        
                        Severity: Minor
                        Found in src/lib/y2network/presenters/interface_summary.rb - About 4 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 Write has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def Write(gui: true, apply_config: !write_only)
                              Builtins.y2milestone("Writing configuration")
                        
                              # Query modified flag in all components, not just LanItems - DNS,
                              # Routing, NetworkConfig too in order not to discard changes made
                        Severity: Minor
                        Found in src/modules/Lan.rb - About 4 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 dialog has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def dialog(name, entry)
                                label = entry ? entry[:label] : ""
                                ip = entry ? entry[:ip] : ""
                                id = entry ? entry[:id] : ""
                                mask = entry ? "/#{entry[:prefixlen]}" : ""
                        Severity: Minor
                        Found in src/lib/y2network/widgets/additional_addresses.rb - About 4 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

                        File routing.rb has 342 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require "yast"
                        require "y2network/config"
                        require "y2network/sysconfig/config_writer"
                        require "y2network/serializer/route_sysconfig"
                        
                        
                        Severity: Minor
                        Found in src/lib/y2network/clients/routing.rb - About 4 hrs to fix

                          Class LanItemsClass has 31 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                            class LanItemsClass < Module
                              include Logger
                              include Wicked
                          
                              def main
                          Severity: Minor
                          Found in src/modules/LanItems.rb - About 3 hrs to fix

                            Class InterfaceFile has 31 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                                class InterfaceFile
                                  # Auxiliar class to hold variables definition information
                                  Variable = Struct.new(:name, :type, :collection?)
                            
                                  # @return [String] Interface name
                            Severity: Minor
                            Found in src/lib/y2network/sysconfig/interface_file.rb - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language