yast/yast-network

View on GitHub

Showing 218 of 255 total issues

File Lan.rb has 577 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 "network/wicked"
Severity: Major
Found in src/modules/Lan.rb - About 1 day to fix

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

    require "shellwords"
    
    module Yast
      module NetworkRoutinesInclude
        include I18n
    Severity: Minor
    Found in src/include/network/routines.rb - About 7 hrs to fix

      Method HostsMainDialog has a Cognitive Complexity of 50 (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 7 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 dns.rb has 468 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "ui/text_helpers"
      
      module Yast
        module NetworkServicesDnsInclude
          include ::UI::TextHelpers
      Severity: Minor
      Found in src/include/network/services/dns.rb - About 7 hrs to fix

        Method initialize_network_services_dns has 173 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 47 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

            Class LanClass has 46 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 6 hrs to fix

              Method HostsMainDialog has 149 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 5 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 ReadHardware has a Cognitive Complexity of 39 (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 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 147 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 140 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 Read has a Cognitive Complexity of 36 (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 text has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def text
                              return "" if @name.to_s.empty?
                      
                              interface = @config.interfaces.by_name(@name)
                              hardware = interface ? interface.hardware : nil
                      Severity: Minor
                      Found in src/lib/y2network/presenters/interface_summary.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 ControllerType has 122 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

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

                        require "yast"
                        require "y2network/config"
                        require "y2network/wicked/config_writer"
                        require "y2network/serializer/route_sysconfig"
                        
                        
                        Severity: Minor
                        Found in src/lib/y2network/clients/routing.rb - About 4 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/cfa/interface_file.rb - About 3 hrs to fix

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

                                def Read(cache)
                                  if cache == :cache && @initialized
                                    Builtins.y2milestone("Using cached data")
                                    return true
                                  end
                            Severity: Major
                            Found in src/modules/Lan.rb - About 3 hrs to fix

                              Method cmdline_definition has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    def cmdline_definition
                                      {
                                        # Commandline help title
                                        "help"       => _("Routing Configuration"),
                                        "id"         => "routing",
                              Severity: Major
                              Found in src/lib/y2network/clients/routing.rb - About 3 hrs to fix

                                Method HostDialog has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def HostDialog(id, entry)
                                      entry = deep_copy(entry)
                                      Builtins.y2debug("id=%1", id)
                                      Builtins.y2debug("entry=%1", entry)
                                
                                
                                Severity: Major
                                Found in src/include/network/services/host.rb - About 3 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language