private List<String> scanResource(final Resource resource,
final Map<String, Object> options) throws IOException {
final List<String> results = new ArrayList<String>();
final Map<String, Object> opts = new HashMap<String, Object>(options);
opts.remove("version");
final Map<String, Object> params = new HashMap<String, Object>();
params.put("source", resource.getContents());
params.put("options", opts);
final StringWriter writer = new StringWriter();
this.executor
.run(new StringReader(new ObjectMapper().writeValueAsString(params)),
writer);
final JsHintResult result = new ObjectMapper().readValue(writer.toString(),
JsHintResult.class);
if (result.errors != null) {
for (final JsHintError error : result.errors) {
results.add(resource.getPath() + " line " + error.line + ": "
+ error.reason + "\n\t" + error.evidence);
}
}
return results;
}