Search in sources :

Example 1 with DefaultNodeVisitor

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;
}
Also used : ComplexityVisitor(org.sonar.plugins.html.analyzers.ComplexityVisitor) DefaultNodeVisitor(org.sonar.plugins.html.visitor.DefaultNodeVisitor) ArrayList(java.util.ArrayList) PageCountLines(org.sonar.plugins.html.analyzers.PageCountLines) NoSonarScanner(org.sonar.plugins.html.visitor.NoSonarScanner) AbstractPageCheck(org.sonar.plugins.html.checks.AbstractPageCheck) HtmlAstScanner(org.sonar.plugins.html.visitor.HtmlAstScanner)

Aggregations

ArrayList (java.util.ArrayList)1 ComplexityVisitor (org.sonar.plugins.html.analyzers.ComplexityVisitor)1 PageCountLines (org.sonar.plugins.html.analyzers.PageCountLines)1 AbstractPageCheck (org.sonar.plugins.html.checks.AbstractPageCheck)1 DefaultNodeVisitor (org.sonar.plugins.html.visitor.DefaultNodeVisitor)1 HtmlAstScanner (org.sonar.plugins.html.visitor.HtmlAstScanner)1 NoSonarScanner (org.sonar.plugins.html.visitor.NoSonarScanner)1