lib/overcommit/hook/pre_commit/w3c_html.rb in overcommit-0.23.0 vs lib/overcommit/hook/pre_commit/w3c_html.rb in overcommit-0.24.0

- old
+ new

@@ -1,26 +1,12 @@ module Overcommit::Hook::PreCommit # Runs `w3c_validators` against any modified HTML files. class W3cHtml < Base def run - begin - require 'w3c_validators' - rescue LoadError - return :fail, 'w3c_validators not installed -- run `gem install w3c_validators`' - end - - result_messages = - begin - collect_messages - rescue W3CValidators::ValidatorUnavailable => e - return :fail, e.message - rescue W3CValidators::ParsingError => e - return :fail, e.message - end - - return :pass if result_messages.empty? - - result_messages + collect_messages + rescue W3CValidators::ParsingError, + W3CValidators::ValidatorUnavailable => e + [:fail, e.message] end private def collect_messages