class Overcommit::Hook::PreCommit::JsonSyntax
Checks the syntax of any modified JSON files.
Public Instance Methods
run()
click to toggle source
# File lib/overcommit/hook/pre_commit/json_syntax.rb, line 6 def run messages = [] applicable_files.each do |file| begin JSON.parse(IO.read(file)) rescue JSON::ParserError => e error = "#{e.message} parsing #{file}" messages << Overcommit::Hook::Message.new(:error, file, nil, error) end end messages end