Class: RuboCop::Daemon::ServerCommand::Exec

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/daemon/server_command/exec.rb

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize

Constructor Details

This class inherits a constructor from RuboCop::Daemon::ServerCommand::Base

Instance Method Details

#runObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rubocop/daemon/server_command/exec.rb', line 7

def run
  Cache.status_path.delete if Cache.status_path.file?
  # RuboCop output is colorized by default where there is a TTY.
  # We must pass the --color option to preserve this behavior.
  @args.unshift('--color') unless %w[--color --no-color].any? { |f| @args.include?(f) }
  status = RuboCop::CLI.new.run(@args)
  # This status file is read by `rubocop-daemon exec` and `rubocop-daemon-wrapper`,
  # so that they use the correct exit code.
  # Status is 1 when there are any issues, and 0 otherwise.
  Cache.write_status_file(status)
rescue SystemExit
  Cache.write_status_file(1)
end