def check(file)
rhino_jar = rhino
js_file = locate_lib
raise FileNotFoundError.new("Unable to locate Rhino jar '#{rhino_jar}'") if !rhino_jar || !File.exists?(rhino_jar)
raise FileNotFoundError.new("Unable to locate JsLint '#{js_file}'") if !js_file || !File.exists?(js_file)
raise FileNotFoundError.new("Unable to locate input file '#{file}'") unless File.exists?(file)
lines = execute("-jar", rhino, locate_lib, file).split("\n")
return Report.new if lines.length == 1 && lines[0] =~ /jslint: No problems/
report = Report.new
lines = lines.reject { |line| !line || "#{line}".strip == "" }
report.add_error(lines.shift, lines.shift) while lines.length > 0
return report
end