public void visitFile(AstNode astNode) {
List<String> lines;
try {
lines = Files.readLines(getContext().getFile(), charset);
} catch (IOException e) {
throw new SonarException(e);
}
for (int i = 0; i < lines.size(); i++) {
String line = lines.get(i);
if (line.length() > 0 && Pattern.matches("[" + EcmaScriptLexer.WHITESPACE + "]", line.subSequence(line.length() - 1, line.length()))) {
getContext().createLineViolation(this, "Remove the useless trailing whitespaces at the end of this line.", i + 1);