Showing 19 of 19 total issues
Method execute
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def execute(command, options = {})
options[:groups] ||= []
options[:env] ||= {}
pid, pid_w = IO.pipe
- 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 drop_privileges
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def drop_privileges(options = {})
# Cannot drop privileges unless we are superuser.
if ::Process.euid == 0
# Drop ~= decrease, since we can only decrease privileges.
- 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 execute
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute(command, options = {})
options[:groups] ||= []
options[:env] ||= {}
pid, pid_w = IO.pipe
Method stop_previous_daemon
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def stop_previous_daemon
if self.pidfile and File.exists?(self.pidfile)
if previous_daemon_pid = File.read(self.pidfile).to_i
# Only attempt to stop automatically if the daemon will run in background.
if self.daemonize and Cognizant::System.pid_running?(previous_daemon_pid)
- 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 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start(options = {})
self.reset!
load_files = []
rb_files = []
Method start
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def start(options = {})
self.reset!
load_files = []
rb_files = []
- 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 _restart_result_handler
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _restart_result_handler(result, time_left = 0)
# If it is a boolean and value is true OR if it's an execution result and it succeeded.
if (!!result == result and result) or (result.respond_to?(:succeeded?) and result.succeeded?)
unlink_pid if not pid_running? and self.daemonize
- 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 read_pid
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def read_pid
if self.pid_command
str = execute(self.pid_command).stdout.to_i
process_pid = str unless not str or str.zero?
# TODO: Write pid to pidfile, since our source was pid_command instead.
- 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 handle_action
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def handle_action(result_handler, options)
# TODO: Works well but can some refactoring make it more declarative?
@action_thread = Thread.new do
result = false
queue, thread = execute_action(options)
- 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 load_file
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def load_file(file)
if file.end_with?(".yml")
yml_config = YAML.load_file(file)
if yml_config
yml_config.deep_symbolize_keys!
- 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 setup_readline
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def setup_readline(&block)
Readline.completion_proc = Proc.new do |input|
case input
when /^\//
# Handle file and directory name autocompletion.
- 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 send_signals
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def send_signals(pid, options = {})
# Return if the process is not running.
return true unless pid_running?(pid)
signals = options[:signals] || ["TERM", "INT"]
- 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_result_handler
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _stop_result_handler(result, time_left = 0)
# If it is a boolean and value is true OR if it's an execution result and it succeeded.
if (!!result == result and result) or (result.respond_to?(:succeeded?) and result.succeeded?)
unlink_pid if not pid_running? and self.daemonize
end
- 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 execute_action
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def execute_action(options)
before_command = options[:before]
command = options[:command]
after_command = options[:after]
signals = options[:signals]
- 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 method_missing
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(name, *args, &block)
if args.size == 1 and name.to_s =~ /^(.*)=$/
@attributes[$1.to_sym] = args.first
elsif args.size == 1
@attributes[name.to_sym] = args.first
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(name, options = {}, &block)
@name = name
@every = options.delete(:every).to_i
@times = options.delete(:times) || 1
- 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_result_handler
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _start_result_handler(result, time_left = 0)
if result.respond_to?(:succeeded?) and result.succeeded?
write_pid(result.pid) if self.daemonize and result.pid != 0
end
- 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 record_transition
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def record_transition(transition)
unless transition.loopback?
@transitioned = true
@last_transition_time = Time.now.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 run_command
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run_command(command, args, &block)
command = command.to_s
begin
response = @client.command({'command' => command, 'args' => args, 'app' => @app})
- 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"