class Overcommit::Hook::PreCommit::Sorbet

Runs ‘srb tc’ against any modified files.

@see github.com/sorbet/sorbet

Constants

MESSAGE_REGEX

example of output: sorbet.rb:1: Method ‘foo` does not exist on `T.class_of(Bar)` srb.help/7003

Public Instance Methods

run() click to toggle source
# File lib/overcommit/hook/pre_commit/sorbet.rb, line 12
def run
  result = execute(command, args: applicable_files)
  return :pass if result.success?

  output = result.stderr.split("\n").grep(MESSAGE_REGEX)

  extract_messages(
    output,
    MESSAGE_REGEX
  )
end