piotrmurach/tty-command

View on GitHub

Showing 9 of 9 total issues

Method initialize has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def initialize(env_or_cmd, *args)
opts = args.last.respond_to?(:to_hash) ? args.pop : {}
if env_or_cmd.respond_to?(:to_hash)
@env = env_or_cmd
unless command = args.shift
Severity: Minor
Found in lib/tty/command/cmd.rb - About 2 hrs to fix

Method spawn has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def spawn(cmd)
process_opts = normalize_redirect_options(cmd.options)
binmode = cmd.options[:binmode] || false
pty = cmd.options[:pty] || false
verbose = cmd.options[:verbose]
Severity: Minor
Found in lib/tty/command/child_process.rb - About 2 hrs to fix

Method spawn has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def spawn(cmd)
process_opts = normalize_redirect_options(cmd.options)
binmode = cmd.options[:binmode] || false
pty = cmd.options[:pty] || false
verbose = cmd.options[:verbose]
Severity: Minor
Found in lib/tty/command/child_process.rb - About 1 hr to fix

    Method write_stream has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def write_stream(stream, input)
    start = Time.now
    writers = [input && stream].compact
     
    while writers.any?
    Severity: Minor
    Found in lib/tty/command/process_runner.rb - About 1 hr to fix

    Method read_stream has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def read_stream(stream, handler)
    Thread.new do
    if Thread.current.respond_to?(:report_on_exception)
    Thread.current.report_on_exception = false
    end
    Severity: Minor
    Found in lib/tty/command/process_runner.rb - About 1 hr to fix

    Method initialize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def initialize(env_or_cmd, *args)
    opts = args.last.respond_to?(:to_hash) ? args.pop : {}
    if env_or_cmd.respond_to?(:to_hash)
    @env = env_or_cmd
    unless command = args.shift
    Severity: Minor
    Found in lib/tty/command/cmd.rb - About 1 hr to fix

      Method write has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def write(cmd, message, data = nil)
      cmd_set_uuid = cmd.options.fetch(:uuid, true)
      uuid_needed = cmd.options[:uuid].nil? ? @uuid : cmd_set_uuid
      out = []
      if uuid_needed
      Severity: Minor
      Found in lib/tty/command/printers/pretty.rb - About 55 mins to fix

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

      def wait(*args)
      pattern = args.pop
      unless pattern
      raise ArgumentError, "Please provide condition to wait for"
      end
      Severity: Minor
      Found in lib/tty/command.rb - About 35 mins to fix

      Method read_streams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def read_streams(stdout, stderr)
      stdout_data = []
      stderr_data = Truncator.new
       
      out_handler = ->(data) {
      Severity: Minor
      Found in lib/tty/command/process_runner.rb - About 25 mins to fix
      Severity
      Category
      Status
      Source
      Language