class Overcommit::Hook::PreCommit::JavaCheckstyle

Runs `checkstyle` against any modified Java files.

@see checkstyle.sourceforge.net/

Constants

MESSAGE_REGEX
MESSAGE_TYPE_CATEGORIZER

Public Instance Methods

run() click to toggle source
# File lib/overcommit/hook/pre_commit/java_checkstyle.rb, line 14
def run
  result = execute(command, args: applicable_files)
  output = result.stdout.chomp

  # example message:
  #   path/to/file.java:3:5: Error message
  extract_messages(
    output.split("\n").grep(MESSAGE_REGEX),
    MESSAGE_REGEX,
    MESSAGE_TYPE_CATEGORIZER
  )
end