use of org.sonar.plugins.html.visitor.DefaultNodeVisitor in project sonar-web by SonarSource.
the class HtmlSensor method setupScanner.
/**
* Create PageScanner with Visitors.
*/
private HtmlAstScanner setupScanner(SensorContext context) {
List<DefaultNodeVisitor> visitors = new ArrayList<>();
if (context.runtime().getProduct() != SonarProduct.SONARLINT) {
visitors.add(new HtmlTokensVisitor(context));
}
visitors.add(new PageCountLines());
visitors.add(new ComplexityVisitor());
visitors.add(new NoSonarScanner(noSonarFilter));
HtmlAstScanner scanner = new HtmlAstScanner(visitors);
for (Object check : checks.all()) {
((AbstractPageCheck) check).setRuleKey(checks.ruleKey(check));
scanner.addVisitor((AbstractPageCheck) check);
}
return scanner;
}
Aggregations