class Overcommit::Hook::PreCommit::ShellCheck

Runs `shellcheck` against any modified shell script files.

@see www.shellcheck.net/

Constants

MESSAGE_TYPE_CATEGORIZER

Public Instance Methods

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

  extract_messages(
    result.stdout.split("\n"),
    /^(?<file>(?:\w:)?[^:]+):(?<line>\d+):[^ ]+ (?<type>[^ ]+)/,
    MESSAGE_TYPE_CATEGORIZER,
  )
end