Add JSHint checks to the Makefile

This commit is contained in:
Saivann 2015-08-21 02:09:10 -04:00
parent cf11cc8240
commit 41195a982d
5 changed files with 134 additions and 1 deletions

20
_contrib/jshint Normal file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env ruby
# This file is licensed under the MIT License (MIT) available on
# http://opensource.org/licenses/MIT.
# Print any warning from JSHint for custom javascript code.
require 'jshintrb'
if ARGV[0].nil?
path_to_check="./_site/js"
else
path_to_check=ARGV[0]
end
Dir.foreach(path_to_check) do |file|
next if !/\.js$/.match(file)
res = Jshintrb.report(File.read(path_to_check + '/' + file), :jshintrc)
print path_to_check + '/' + file + "\n" + res if res.length != 0
end