yast/yast-network

View on GitHub
src/lib/y2network/autoinst/interfaces_reader.rb

Summary

Maintainability
C
1 day
Test Coverage

Method load_generic has a Cognitive Complexity of 21 (exceeds 5 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 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 a Cognitive Complexity of 20 (exceeds 5 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: Minor
Found in src/lib/y2network/autoinst/interfaces_reader.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 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 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

      There are no issues that match your filters.

      Category
      Status