Sha256: 94010415dc33f9b11a01339fba28e66005d0e30fa4aa8b6590f124f7c132319d
Contents?: true
Size: 624 Bytes
Versions: 28
Compression:
Stored size: 624 Bytes
Contents
module Overcommit::Hook::PreCommit # Runs `jshint` against any modified JavaScript files. # # @see http://jshint.com/ class JsHint < Base def run result = execute(command, args: applicable_files) output = result.stdout.chomp return :pass if result.success? && output.empty? # example message: # path/to/file.js: line 1, col 0, Error message (E001) extract_messages( output.split("\n").grep(/E|W/), /^(?<file>(?:\w:)?[^:]+):[^\d]+(?<line>\d+).+\((?<type>E|W)\d+\)/, lambda { |type| type.include?('W') ? :warning : :error } ) end end end
Version data entries
28 entries across 26 versions & 2 rubygems