Method: Overcommit::Hook::PreCommit::PhpCs#parse_messages

Defined in:
lib/overcommit/hook/pre_commit/php_cs.rb

#parse_messages(messages) ⇒ Object

Transform the CSV output into a tidy human readable message



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/overcommit/hook/pre_commit/php_cs.rb', line 36

def parse_messages(messages)
  output = []

  messages.map do |message|
    message.scan(MESSAGE_REGEX).map do |file, line, type, msg|
      type = MESSAGE_TYPE_CATEGORIZER.call(type)
      text = " #{file}:#{line}\n  #{msg}"
      output << Overcommit::Hook::Message.new(type, file, line.to_i, text)
    end
  end

  output
end