Sha256: ffdbcb0c1a908305d856970215c57e834bd0fd925df7e3005429a8372fbb3ba3

Contents?: true

Size: 471 Bytes

Versions: 32

Compression:

Stored size: 471 Bytes

Contents

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

32 entries across 30 versions & 2 rubygems

Version Path
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/lib/overcommit/hook/pre_commit/xml_syntax.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/lib/overcommit/hook/pre_commit/xml_syntax.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/lib/overcommit/hook/pre_commit/xml_syntax.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/lib/overcommit/hook/pre_commit/xml_syntax.rb
overcommit-0.46.0 lib/overcommit/hook/pre_commit/xml_syntax.rb
overcommit-0.45.0 lib/overcommit/hook/pre_commit/xml_syntax.rb
overcommit-0.44.0 lib/overcommit/hook/pre_commit/xml_syntax.rb
overcommit-0.43.0 lib/overcommit/hook/pre_commit/xml_syntax.rb
overcommit-0.42.0 lib/overcommit/hook/pre_commit/xml_syntax.rb
overcommit-0.41.0 lib/overcommit/hook/pre_commit/xml_syntax.rb
overcommit-0.40.0 lib/overcommit/hook/pre_commit/xml_syntax.rb
overcommit-0.39.1 lib/overcommit/hook/pre_commit/xml_syntax.rb
overcommit-0.39.0 lib/overcommit/hook/pre_commit/xml_syntax.rb
overcommit-0.38.0 lib/overcommit/hook/pre_commit/xml_syntax.rb
overcommit-0.37.0 lib/overcommit/hook/pre_commit/xml_syntax.rb
overcommit-0.36.0 lib/overcommit/hook/pre_commit/xml_syntax.rb
overcommit-0.35.0 lib/overcommit/hook/pre_commit/xml_syntax.rb
overcommit-0.34.2 lib/overcommit/hook/pre_commit/xml_syntax.rb
overcommit-0.34.1 lib/overcommit/hook/pre_commit/xml_syntax.rb
overcommit-0.34.0 lib/overcommit/hook/pre_commit/xml_syntax.rb