class Overcommit::Hook::PreCommit::Scalariform

Runs ‘scalariform` against any modified Scala files.

@see github.com/mdr/scalariform

Constants

MESSAGE_REGEX

Public Instance Methods

run() click to toggle source
# File lib/overcommit/hook/pre_commit/scalariform.rb, line 10
def run
  result = execute(command, args: applicable_files)

  # example message:
  #   [FAILED] path/to/file.scala
  extract_messages(
    result.stdout.split("\n").grep(MESSAGE_REGEX),
    MESSAGE_REGEX,
    lambda { |type| type == 'ERROR' ? :error : :warning }
  )
end