File write_behind.rb
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'thread'
require 'roma/stats'
require 'socket'
require 'roma/messaging/con_pool'
require 'timeout'
Method update_rttable
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update_rttable(nid)
Timeout.timeout(1) do
con = Roma::Messaging::ConPool.instance.get_connection(nid)
con.write "routingdump\r\n"
routes_length = con.gets.to_i
- 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 wb_process_loop
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def wb_process_loop
loop {
while dat = @@wb_queue.pop
# dat ====> [hname, cmd, key, value]
@cr_writer.transmit(dat[1], dat[2], dat[3]) unless dat[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
Method change_mklhash?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def change_mklhash?
con = Roma::Messaging::ConPool.instance.get_connection(@replica_nodelist[0])
con.write("mklhash 0\r\n")
current_mklhash = con.gets.chomp
Roma::Messaging::ConPool.instance.return_connection(@replica_nodelist[0], con)
- 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"