yast/yast-network

View on GitHub

Showing 218 of 255 total issues

Method MainDialog has a Cognitive Complexity of 10 (exceeds 5 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

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_ip_forwarding has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def write_ip_forwarding(routing, issues_list)
      sysctl_config = CFA::SysctlConfig.new
      sysctl_config.load
      sysctl_config.forward_ipv4 = routing.forward_ipv4
      sysctl_config.forward_ipv6 = routing.forward_ipv6
Severity: Minor
Found in src/lib/y2network/config_writer.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 items has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def items
        @routing_table.routes.map.each_with_index do |route, index|
          [
            index,
            route.to.yield_self do |to|
Severity: Minor
Found in src/lib/y2network/widgets/routing_table.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 handle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def handle(event)
          return nil if event["EventReason"] != "Activated"

          cur = Yast::UI.QueryWidget(Id(:wep_keys_table), :CurrentItem).to_i
          case event["ID"]
Severity: Minor
Found in src/lib/y2network/dialogs/wireless_wep_keys.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 update_sysconfig_dhcp has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def update_sysconfig_dhcp(hostname, old_hostname)
        if old_hostname.nil? || old_hostname.dhcp_hostname == hostname.dhcp_hostname
          log.info("No update for /etc/sysconfig/network/dhcp")
          return
        end
Severity: Minor
Found in src/lib/y2network/config_writers/hostname_writer.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 activate_s390_devices has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def activate_s390_devices(section = nil)
      profile_devices = section || ay_networking_section["s390-devices"] || {}
      devices_section = Y2Network::AutoinstProfile::S390DevicesSection
        .new_from_hashes(profile_devices)
      connections = Y2Network::Autoinst::S390DevicesReader.new(devices_section).config
Severity: Minor
Found in src/lib/network/network_autoyast.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 bondable? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def bondable?(iface)
        Yast.import "Arch"
        Yast.include self, "network/lan/s390.rb"

        # check if the device is L2 capable on s390
Severity: Minor
Found in src/lib/y2network/interface_config_builders/bonding.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 delete_hostname has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def delete_hostname(hostname)
      entries = data.select(hostname_matcher(hostname))
      entries.each do |pair|
        entry = pair[:value]
        if entry["canonical"] == hostname
Severity: Minor
Found in src/lib/cfa/hosts.rb - About 1 hr to fix

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

          def port_items_from(add_ifaces, included_ifaces, config)
            raise ArgumentError, "list of devices for adding cannot be nil" if add_ifaces.nil?
            raise ArgumentError, "some interfaces must be selected" if included_ifaces.nil?
    
            if add_ifaces.empty? && !included_ifaces.empty?
    Severity: Minor
    Found in src/lib/y2network/widgets/port_items.rb - About 1 hr to fix

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

            def handle(event)
              return nil if event["EventReason"] != "Activated"
      
              cur = Yast::UI.QueryWidget(Id(:address_table), :CurrentItem).to_i
              case event["ID"]
      Severity: Minor
      Found in src/lib/y2network/widgets/additional_addresses.rb - About 1 hr to fix

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

              def contents
                textdomain "network"
        
                HBox(
                  HSpacing(6),
        Severity: Minor
        Found in src/lib/y2network/dialogs/s390_qeth_activation.rb - About 1 hr to fix

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

                def status_info(config)
                  textdomain "network"
          
                  case config.bootproto
                  when BootProtocol::STATIC
          Severity: Minor
          Found in src/lib/y2network/presenters/interface_status.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 aliases_to_ip_configs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def aliases_to_ip_configs
                last_id = 0
                used_ids = aliases
                  .select { |a| a[:id] && a[:id] =~ /\A_\d+\z/ }
                  .map { |a| a[:id].sub("_", "").to_i }
          Severity: Minor
          Found in src/lib/y2network/interface_config_builder.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 main has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def main
                Yast.import "UI"
          
                textdomain "network"
          
          
          Severity: Minor
          Found in src/clients/host_auto.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 EditHandler has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def EditHandler(options)
                  log.info("Edit handler, options: #{options.inspect}")
          
                  # validator: a reference to boolean( string) is expected
                  # setter: a reference to void( any) is expected
          Severity: Minor
          Found in src/lib/y2network/clients/dns.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 filter_out has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def filter_out(device_info, driver)
                # filter out device with virtio_pci Driver and no Device File (bnc#585506)
                if driver == "virtio_pci" && (device_info["dev_name"] || "") == ""
                  log.info("Filtering out virtio device without device file.")
                  return true
          Severity: Minor
          Found in src/include/network/routines.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 proposal_text has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def proposal_text
                  items = []
                  items << list_item_for(dhcp_summary) unless dhcp_ifaces.empty?
                  items << list_item_for(static_summary) unless static_ifaces.empty?
                  items << list_item_for(bridge_summary) unless bridge_connections.empty?
          Severity: Minor
          Found in src/lib/y2network/presenters/interfaces_summary.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 contents has a Cognitive Complexity of 9 (exceeds 5 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 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 write_interface_routes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def write_interface_routes(config, old_config, _issues_list)
                  # Write ifroute files
                  config.interfaces.each do |dev|
                    # S390 devices that have not been activated yet will be part of the
                    # collection but with an empty name.
          Severity: Minor
          Found in src/lib/y2network/wicked/config_writer.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 eth_type_by_sys has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def eth_type_by_sys(iface)
                  sys_dir_path = "/sys/class/net/#{iface}"
          
                  if ::File.exist?("#{sys_dir_path}/wireless") || ::File.exist?("#{sys_dir_path}/phy80211")
                    InterfaceType::WIRELESS
          Severity: Minor
          Found in src/lib/y2network/type_detector.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

          Severity
          Category
          Status
          Source
          Language