lib/facter/resolvers/aix/networking.rb
Method populate_with_mtu_and_mac!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def populate_with_mtu_and_mac!(interfaces)
output = Facter::Core::Execution.execute('netstat -in', logger: log)
output.each_line do |line|
next if /Name\s/.match?(line)
- Read upRead up
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 build_bindings
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def build_bindings(name, ip, mask_length, is_ipv4)
bind_to_add = is_ipv4 ? :bindings : :bindings6
ip = ip.gsub(/%[0-9]$/, '') # remove mask information if it exists
mask_length = mask_length.to_i - 1 unless is_ipv4
@fact_list[:interfaces][name] ||= {}
- Read upRead up
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"