Showing 6 of 6 total issues
Method fork_it
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def self.fork_it(options)
# The problem with rails is that it only has one connection (per class),
# so when we fork a new process, we need to reconnect.
@@logger.debug "spawn> parent PID = #{Process.pid}" if @@logger
child = fork do
- 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 clear_reloadable_connections!
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.clear_reloadable_connections!
if @@allow_concurrency
# Hash keyed by thread_id in @@active_connections. Hash of hashes.
@@active_connections.each do |thread_id, conns|
conns.each do |name, conn|
- 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 fork_it
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.fork_it(options)
# The problem with rails is that it only has one connection (per class),
# so when we fork a new process, we need to reconnect.
@@logger.debug "spawn> parent PID = #{Process.pid}" if @@logger
child = fork do
Method run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.run(opts = {}, &block)
raise "Must give block of code to be spawned" unless block_given?
options = @@default_options.merge(symbolize_options(opts))
# setting options[:method] will override configured value in default_options[:method]
case options.fetch(:method)
- 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 kill_punks
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.kill_punks
@@punks.each do |punk|
if alive?(punk)
@@logger.info "spawn> parent(#{Process.pid}) killing child(#{punk})" if @@logger
begin
- 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 wait
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.wait(sids = [])
# wait for all threads and/or forks (if a single sid passed in, convert to array first)
Array(sids).each do |sid|
if sid.type == :thread
sid.handle.join()
- 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"