yast/yast-network

View on GitHub
src/lib/y2network/interface_config_builder.rb

Summary

Maintainability
C
1 day
Test Coverage

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

    File interface_config_builder.rb has 283 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "yast"
    require "forwardable"
    
    require "y2network/connection_config"
    require "y2network/hwinfo"
    Severity: Minor
    Found in src/lib/y2network/interface_config_builder.rb - About 2 hrs to fix

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

      There are no issues that match your filters.

      Category
      Status