Method validate_option_values
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
def validate_option_values(options)
options.each do |option, value|
valid_option_pairs.each do |pair|
long_option_name, _ = pair
next unless option == long_option_name
File process_helper.rb
has 270 lines of code (exceeds 250 allowed). Consider refactoring.
require 'open3'
require 'pty'
require 'timeout'
require 'stringio'
Method get_output
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
def get_output(stdin, stdout_and_stderr, options)
input = options[:input]
always_puts_output = (options[:puts_output] == :always)
timeout = options[:timeout]
output = ''
Method get_output
has 44 lines of code (exceeds 25 allowed). Consider refactoring.
def get_output(stdin, stdout_and_stderr, options)
input = options[:input]
always_puts_output = (options[:puts_output] == :always)
timeout = options[:timeout]
output = ''
Method process_with_pseudo_terminal
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
def process_with_pseudo_terminal(cmd, options)
max_seconds_to_wait_for_pid_to_exit = options[:timeout] || 60
PTY.spawn(cmd) do |stdout_and_stderr, stdin, pid|
output = get_output(stdin, stdout_and_stderr, options)
Method validate_long_vs_short_option_uniqueness
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
def validate_long_vs_short_option_uniqueness(options)
invalid_options = (options.keys - valid_options)
fail(
ProcessHelper::InvalidOptionsError,
"Invalid option(s) '#{invalid_options.join(', ')}' given. " \
Method set_option_defaults
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
def set_option_defaults(options)
options[:puts_output] = :always if options[:puts_output].nil?
options[:include_output_in_exception] = true if options[:include_output_in_exception].nil?
options[:pseudo_terminal] = false if options[:pseudo_terminal].nil?
options[:expected_exit_status] = [0] if options[:expected_exit_status].nil?