class Overcommit::Hook::PreCommit::SlimLint

Runs `slim-lint` against any modified Slim templates.

@see github.com/sds/slim-lint

Constants

MESSAGE_TYPE_CATEGORIZER

Public Instance Methods

run() click to toggle source
# File lib/overcommit/hook/pre_commit/slim_lint.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