yast/yast-network

View on GitHub

Showing 218 of 255 total issues

Method ControllerType has a Cognitive Complexity of 16 (exceeds 5 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: Minor
Found in src/include/network/routines.rb - About 2 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 load_wireless has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def load_wireless(config, interface_section)
        if !interface_section.wireless_mode.to_s.empty?
          config.mode = interface_section.wireless_mode
        end
        config.ap = interface_section.wireless_ap if !interface_section.wireless_ap.to_s.empty?
Severity: Major
Found in src/lib/y2network/autoinst/interfaces_reader.rb - About 2 hrs to fix

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

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

      Method PackagesInstall has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def PackagesInstall(packages)
            packages = deep_copy(packages)
            return :next if packages == []
      
            log.info "Checking packages: #{packages}"
      Severity: Minor
      Found in src/include/network/routines.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 initialize_network_lan_dhcp has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def initialize_network_lan_dhcp(include_target)
            Yast.import "UI"
      
            textdomain "network"
      
      
      Severity: Minor
      Found in src/include/network/lan/dhcp.rb - About 1 hr to fix

        Method load_generic has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def load_generic(config, interface_section)
                if interface_section.bootproto.to_s.empty?
                  issues_list.add(::Installation::AutoinstIssues::MissingValue,
                    interface_section, :bootproto)
                else
        Severity: Minor
        Found in src/lib/y2network/autoinst/interfaces_reader.rb - About 1 hr to fix

          Method init_from_config has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

                def init_from_config(config)
                  # nil bootproto is valid use case (missing explicit setup) - wicked defaults to static then
                  @bootproto = config.bootproto&.name
                  @name = config.name
                  @lladdr = config.lladdress
          Severity: Minor
          Found in src/lib/y2network/autoinst_profile/interface_section.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 validate has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def validate
                  return true if value != :bootproto_static
          
                  ipa = Yast::UI.QueryWidget(:bootproto_ipaddr, :Value)
                  if !Yast::IP.Check(ipa)
          Severity: Minor
          Found in src/lib/y2network/widgets/boot_protocol.rb - About 1 hr to fix

            Method MainDialog has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def MainDialog(init_tab)
                  caption = _("Network Settings")
                  widget_descr = {
                    "tab" => CWMTab.CreateWidget(
                      "tab_order"    => if Systemd.Running
            Severity: Minor
            Found in src/include/network/lan/complex.rb - About 1 hr to fix

              Method adapt_for_autoyast has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def adapt_for_autoyast(settings)
                      settings = deep_copy(settings)
                      interfaces = settings["interfaces"] || []
                      log.info("interfaces: #{interfaces.inspect}")
                      net_udev = settings["net-udev"] || []
              Severity: Minor
              Found in src/lib/y2network/clients/auto.rb - About 1 hr to fix

                Method init has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def init
                        case @settings.boot_protocol
                        when Y2Network::BootProtocol::STATIC
                          Yast::UI.ChangeWidget(Id(:bootproto), :CurrentButton, :bootproto_static)
                          Yast::UI.ChangeWidget(
                Severity: Minor
                Found in src/lib/y2network/widgets/boot_protocol.rb - About 1 hr to fix

                  Method IsHostLocal has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def IsHostLocal(check_host)
                        Read()
                        current_dhcp_data = {}
                        connections = Yast::Lan.yast_config.connections
                  
                  
                  Severity: Minor
                  Found in src/modules/DNS.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 save has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def save
                        @connection_config.name = name
                        @connection_config.interface = name
                        @connection_config.ip_aliases = aliases_to_ip_configs
                  
                  
                  Severity: Minor
                  Found in src/lib/y2network/interface_config_builder.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 contents has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def contents
                          type = @settings.type
                  
                          drvtype = driver_type(type.short_name)
                          # TODO: check if this kind of device is still valid and used
                  Severity: Minor
                  Found in src/lib/y2network/widgets/address_tab.rb - About 1 hr to fix

                    Method init_from_config has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def init_from_config(config)
                            # nil bootproto is valid use case (missing explicit setup) - wicked defaults to static then
                            @bootproto = config.bootproto&.name
                            @name = config.name
                            @lladdr = config.lladdress
                    Severity: Minor
                    Found in src/lib/y2network/autoinst_profile/interface_section.rb - About 1 hr to fix

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

                          def main
                            Yast.import "UI"
                      
                            textdomain "network"
                      
                      
                      Severity: Minor
                      Found in src/clients/host.rb - About 1 hr to fix

                        Method store has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def store
                                # FIXME: this value reset should be in backend in general not Yast::UI responsibility
                                @settings.ip_address = ""
                                @settings.subnet_prefix = ""
                                case value
                        Severity: Minor
                        Found in src/lib/y2network/widgets/boot_protocol.rb - About 1 hr to fix

                          Method help has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                def help
                                  # tricky init only to not break long help text translations
                                  items_help =
                                    [
                                      # TRANSLATORS: help text for Device Activation
                          Severity: Minor
                          Found in src/lib/y2network/widgets/startmode.rb - About 1 hr to fix

                            Method propose_startmode has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def propose_startmode
                                    Yast.import "ProductFeatures"
                            
                                    if root_filesystem_in_network?
                                      log.info "startmode nfsroot"
                            Severity: Minor
                            Found in src/lib/y2network/connection_config/base.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 Packages has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def Packages
                                  backend = if Mode.autoinst
                                    Y2Network::Backend.all.find { |b| b.id == proposal_settings.current_backend }
                                  else
                                    yast_config&.backend
                            Severity: Minor
                            Found in src/modules/Lan.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