Class IPClass
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class IPClass < Module
include Yast::Logger
def main
textdomain "base"
Method reserved4
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def reserved4(ip)
raise "Invalid IP address passed '#{ip}'" unless Check4(ip)
# RFC#1700
return true if ip.start_with?("0.")
- 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
Avoid too many return
statements within this method. Open
return true if ip.start_with?("198.51.100.")
Avoid too many return
statements within this method. Open
return true if ds_lite_address?(ip)
Avoid too many return
statements within this method. Open
return true if ip.start_with?("192.0.2.")
Avoid too many return
statements within this method. Open
return true if private_network?(ip)
Avoid too many return
statements within this method. Open
return true if ip.start_with?("192.88.99.")
Avoid too many return
statements within this method. Open
return true if ip.start_with?("192.18.")
Avoid too many return
statements within this method. Open
return true if ip.start_with?("192.19.")
Avoid too many return
statements within this method. Open
return true if ip.start_with?("203.0.113.")
Avoid too many return
statements within this method. Open
return true if (224..255).cover?(ip.split(".").first.to_i)
Method CheckNetwork4
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def CheckNetwork4(network)
generic_check = CheckNetworkShared(network)
return generic_check unless generic_check.nil?
# 192.168.0.0/20, 0.8.55/158
- 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 CheckNetwork6
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def CheckNetwork6(network)
generic_check = CheckNetworkShared(network)
return generic_check unless generic_check.nil?
# 2001:db8:0::1/64
- 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"