thewoolleyman/process_helper

View on GitHub

Showing 7 of 7 total issues

Method validate_option_values has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

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
Severity: Minor
Found in lib/process_helper.rb - About 2 hrs to fix

File process_helper.rb has 270 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'open3'
require 'pty'
require 'timeout'
require 'stringio'
 
 
Severity: Minor
Found in lib/process_helper.rb - About 2 hrs to fix

    Method get_output has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_output(stdin, stdout_and_stderr, options)
    input = options[:input]
    always_puts_output = (options[:puts_output] == :always)
    timeout = options[:timeout]
    output = ''
    Severity: Minor
    Found in lib/process_helper.rb - About 2 hrs to fix

    Method get_output has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def get_output(stdin, stdout_and_stderr, options)
    input = options[:input]
    always_puts_output = (options[:puts_output] == :always)
    timeout = options[:timeout]
    output = ''
    Severity: Minor
    Found in lib/process_helper.rb - About 1 hr to fix

      Method process_with_pseudo_terminal has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      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)
      # TODO: come up with a test that illustrates pid not exiting by the time PTY exits
      Severity: Minor
      Found in lib/process_helper.rb - About 1 hr to fix

      Method validate_long_vs_short_option_uniqueness has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def validate_long_vs_short_option_uniqueness(options)
      invalid_options = (options.keys - valid_options)
      fail(
      ProcessHelper::InvalidOptionsError,
      "Invalid option(s) '#{invalid_options.join(', ')}' given. " \
      Severity: Minor
      Found in lib/process_helper.rb - About 35 mins to fix

      Method set_option_defaults has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      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?
      Severity: Minor
      Found in lib/process_helper.rb - About 35 mins to fix
      Severity
      Category
      Status
      Source
      Language