Method scanner_recv
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def scanner_recv(timeout = 0.1)
queue = []
start = Time.now
while Time.now - start < timeout do
readable, _, _ = ::IO.select(@udp_sockets.values, nil, nil, timeout)
- 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 scanner_send
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scanner_send(data, ip, port)
# flatten any bindata objects
data = data.to_binary_s if data.respond_to?('to_binary_s')
Method udp_socket
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def udp_socket(ip, port, bind_peer: true)
key = "#{ip}:#{port}:#{bind_peer ? 'bound' : 'unbound'}"
@udp_sockets_mutex.synchronize do
unless @udp_sockets.key?(key)
sock_info = {
- 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 scanner_send
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def scanner_send(data, ip, port)
# flatten any bindata objects
data = data.to_binary_s if data.respond_to?('to_binary_s')
- 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 scanner_spoof_send
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def scanner_spoof_send(data, ip, port, srcip, num_packets=1)