Module: Overcommit::Hook::Shared::Pronto
- Included in:
- PreCommit::Pronto, PrePush::Pronto
- Defined in:
- lib/overcommit/hook/shared/pronto.rb
Overview
Constant Summary collapse
- MESSAGE_TYPE_CATEGORIZER =
lambda do |type| type.include?('E') ? :error : :warning end
- MESSAGE_REGEX =
/^(?<file>(?:\w:)?[^:]+):(?<line>\d+) (?<type>[^ ]+)/.freeze
Instance Method Summary collapse
Instance Method Details
#run ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/overcommit/hook/shared/pronto.rb', line 14 def run result = execute(command) return :pass if result.success? ( result.stdout.split("\n").select { |line| line.match?(MESSAGE_REGEX) }, MESSAGE_REGEX, MESSAGE_TYPE_CATEGORIZER, ) end |