Sha256: f127328063020ea4d2f1ed6807eea0c8c2d09c32b87e3e843d92d3346cee5408
Contents?: true
Size: 434 Bytes
Versions: 3
Compression:
Stored size: 434 Bytes
Contents
require 'json' module Overcommit::Hook::PreCommit # Checks the syntax of any modified JSON files. class JsonSyntax < Base def run output = [] applicable_files.each do |file| begin JSON.parse(IO.read(file)) rescue JSON::ParserError => e output << "#{e.message} parsing #{file}" end end return :good if output.empty? [:bad, output] end end end
Version data entries
3 entries across 3 versions & 1 rubygems