Showing 7 of 7 total issues
Class Daemon
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Daemon
# Initialize the daemon in the given working root.
def initialize(working_directory = ".")
@working_directory = working_directory
Method spawn
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def spawn
@daemon.prefork
@daemon.mark_log
fork do
Method stop
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def stop
@output.puts Rainbow("Stopping #{@daemon.name} daemon...").blue
# Check if the pid file exists...
unless File.file?(@daemon.process_file_path)
- 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 stop_by_terminate_or_kill
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def stop_by_terminate_or_kill(pgid)
# TERM/KILL loop - if the daemon didn't die easily, shoot it a few more times.
(STOP_ATTEMPTS+1).times do |attempt|
break unless ProcessFile.running(@daemon)
- 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 reverse_gets
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def reverse_gets(sep_string=$/)
end_pos = tell
offset = nil
buf = ""
- 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 start
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def start
@output.puts Rainbow("Starting #{@daemon.name} daemon...").blue
case self.status
when :running
- 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 wait(timeout: nil)
if timeout
read_ready, _, _ = IO.select([@output], [], [], timeout)
return false unless read_ready and read_ready.any?
- 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"