yast/yast-network

View on GitHub
src/lib/cfa/interface_file.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Class InterfaceFile has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

  class InterfaceFile
    # Auxiliar class to hold variables definition information
    Variable = Struct.new(:name, :type, :collection?)

    # @return [String] Interface name
Severity: Minor
Found in src/lib/cfa/interface_file.rb - About 3 hrs to fix

    Method write_collection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def write_collection(key, values)
          clean_collection(key)
          values.sort_by { |s, _v| (s == :default) ? "" : s.to_s }.each do |suffix, value|
            write_key = (suffix == :default) ? key : "#{key}#{suffix}"
            write_scalar(write_key, value)
    Severity: Minor
    Found in src/lib/cfa/interface_file.rb - About 35 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