yast/yast-network

View on GitHub

Showing 255 of 255 total issues

Avoid too many return statements within this method.
Open

          return false
Severity: Major
Found in src/lib/y2network/interface_config_builders/bridge.rb - About 30 mins to fix

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

            def device_id_from(conn)
              return if conn.interface.to_s.empty?
    
              cmd = [LIST_CMD, "ctc", "-c", "id", "-n", "--by-interface=#{conn.interface}"]
    
    
    Severity: Minor
    Found in src/lib/y2network/wicked/connection_config_readers/ctc.rb and 1 other location - About 30 mins to fix
    src/lib/y2network/wicked/connection_config_readers/qeth.rb on lines 40..47

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

    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 device_id_from(conn)
              return if conn.interface.to_s.empty?
    
              cmd = [LIST_CMD, "qeth", "-c", "id", "-n", "--by-interface=#{conn.interface}"]
    
    
    Severity: Minor
    Found in src/lib/y2network/wicked/connection_config_readers/qeth.rb and 1 other location - About 30 mins to fix
    src/lib/y2network/wicked/connection_config_readers/ctc.rb on lines 36..43

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

    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

        class ServerCAPath < PathWidget
          def initialize(builder)
            super()
            textdomain "network"
            @builder = builder
    Severity: Minor
    Found in src/lib/y2network/widgets/server_ca_path.rb and 1 other location - About 25 mins to fix
    src/lib/y2network/widgets/client_key.rb on lines 53..77

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

    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

        class ClientKeyPath < PathWidget
          def initialize(builder)
            super()
            textdomain "network"
            @builder = builder
    Severity: Minor
    Found in src/lib/y2network/widgets/client_key.rb and 1 other location - About 25 mins to fix
    src/lib/y2network/widgets/server_ca_path.rb on lines 24..52

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

    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 3 locations. Consider refactoring.
    Open

        class << self
          # Returns all the existing protocols
          #
          # @return [Array<BootProtocol>]
          def all
    Severity: Minor
    Found in src/lib/y2network/boot_protocol.rb and 2 other locations - About 25 mins to fix
    src/lib/y2network/ipoib_mode.rb on lines 29..44
    src/lib/y2network/wireless_auth_mode.rb on lines 31..46

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

    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 3 locations. Consider refactoring.
    Open

        class << self
          # Returns all the existing modes
          #
          # @return [Array<WirelessAuthMode>] Wireless authentication modes
          def all
    Severity: Minor
    Found in src/lib/y2network/wireless_auth_mode.rb and 2 other locations - About 25 mins to fix
    src/lib/y2network/boot_protocol.rb on lines 28..43
    src/lib/y2network/ipoib_mode.rb on lines 29..44

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

    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 3 locations. Consider refactoring.
    Open

        class << self
          # Returns all the existing modes
          #
          # @return [Array<IpoibMode>]
          def all
    Severity: Minor
    Found in src/lib/y2network/ipoib_mode.rb and 2 other locations - About 25 mins to fix
    src/lib/y2network/boot_protocol.rb on lines 28..43
    src/lib/y2network/wireless_auth_mode.rb on lines 31..46

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

    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

    Method needed_modules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def needed_modules(netcards_hwinfo)
          netcards_hwinfo.each_with_object([]) do |h, modules|
            name = h.fetch("module", "")
            next if name.empty?
    
    
    Severity: Minor
    Found in src/modules/NetHwDetection.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 AddHandler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def AddHandler(options)
          # slaves option is marked as obsolete, bond_ports should be used instead.
          # If both options are present, new one (bond_ports) wins.
          if !options.key?("bond_ports") && options.key?("slaves")
            options["bond_ports"] = options.delete("slaves")
    Severity: Minor
    Found in src/include/network/lan/cmdline.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 ensure_network_running has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def ensure_network_running
          network = false
          timeout = NM_DHCP_TIMEOUT
          while timeout > 0
            if NetworkService.isNetworkRunning
    Severity: Minor
    Found in src/modules/Lan.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 encode_hosts_line has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def encode_hosts_line(canonical, aliases)
          encoded_aliases = aliases ? Punycode.EncodePunycodes(aliases) : []
          encoded_canonical = canonical ? Punycode.EncodeDomainName(canonical) : ""
    
          encoded = ""
    Severity: Minor
    Found in src/include/network/services/host.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 HardwareName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def HardwareName(hardware, id)
          return "" if id.nil? || id.empty?
          return "" if hardware.nil? || hardware.empty?
    
          # filter out a list of hwinfos which correspond to the given id
    Severity: Minor
    Found in src/include/network/complex.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 Modified has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def Modified
          return true if @modified
          return true unless system_config == yast_config
          return true if NetworkConfig.Modified
          return true if NetworkService.Modified
    Severity: Minor
    Found in src/modules/Lan.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 AddressDialog has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def AddressDialog(builder:)
          ret = Y2Network::Dialogs::EditInterface.run(builder)
    
          log.info "AddressDialog res: #{ret.inspect}"
    
    
    Severity: Minor
    Found in src/include/network/lan/address.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 config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def config
            configs = @section.interfaces.map do |interface_section|
              log.info "Creating config for interface section: #{interface_section.inspect}"
              config = create_config(interface_section)
              config.propose # propose reasonable defaults for not set attributes
    Severity: Minor
    Found in src/lib/y2network/autoinst/interfaces_reader.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 handle has a Cognitive Complexity of 6 (exceeds 5 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 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 new_from_network has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.new_from_network(config)
            result = new
            return result unless config
    
            result.managed = config.backend?(:network_manager)
    Severity: Minor
    Found in src/lib/y2network/autoinst_profile/networking_section.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 main has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def main
          nac = NetworkAutoconfiguration.instance
          set_dhcp_hostname! if Stage.initial
    
          if Yast::NetworkService.wicked?
    Severity: Minor
    Found in src/lib/network/clients/inst_setup_dhcp.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 link_routes_to_interfaces has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def link_routes_to_interfaces(routes, interfaces)
            routes.each do |route|
              next unless route.interface
    
              interface = interfaces.by_name(route.interface.name)
    Severity: Minor
    Found in src/lib/y2network/wicked/config_reader.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

    Severity
    Category
    Status
    Source
    Language