Sha256: e673b77f6a9892b6935118917fb159e0076b0664d7c82be4e96f36ca641d7be5
Contents?: true
Size: 502 Bytes
Versions: 25
Compression:
Stored size: 502 Bytes
Contents
# frozen_string_literal: true module Overcommit::Hook::PreCommit # Checks the syntax of any modified XML files. class XmlSyntax < Base def run messages = [] applicable_files.each do |file| begin REXML::Document.new(IO.read(file)) rescue REXML::ParseException => e error = "Error parsing #{file}: #{e.message}" messages << Overcommit::Hook::Message.new(:error, file, nil, error) end end messages end end end
Version data entries
25 entries across 25 versions & 2 rubygems