```ruby
module Overcommit::Hook::PreCommit
  # Checks the syntax of any modified YAML files.
  class YamlSyntax < Base
    def run
      output = []

      applicable_files.each do |file|
        begin
          YAML.load_file(file)
        rescue ArgumentError => e
          output << "#{e.message} parsing #{file}"
        end
      end

      return :pass if output.empty?

      [:fail, output]
    end
  end
end
```

Change YamlSyntax hook to use hook messages
user
```ruby
module Overcommit::Hook::PreCommit
  # Checks the syntax of any modified YAML files.
  class YamlSyntax < Base
    def run
      messages = []

      applicable_files.each do |file|
        begin
          YAML.load_file(file)
        rescue ArgumentError, Psych::SyntaxError => e
          messages << Overcommit::Hook::Message.new(:error, file, nil, e.message)
        end
      end

      messages
    end
  end
end
```
assistant