public void check ( SoyFileNode file , final ErrorReporter errorReporter ) { // first filter to only the rules that need to be checked for this file. final List < Rule < ? > > rulesForFile = new ArrayList <> ( rules . size ( ) ) ; String filePath = file . getFilePath ( ) ; for ( RuleWithWhitelists rule : rules ) { if ( rule . shouldCheckConformanceFor ( filePath ) ) { rulesForFile . add ( rule . getRule ( ) ) ; } } if ( rulesForFile . isEmpty ( ) ) { return ; } SoyTreeUtils . visitAllNodes ( file , new NodeVisitor < Node , VisitDirective > ( ) { @ Override public VisitDirective exec ( Node node ) { for ( Rule < ? > rule : rulesForFile ) { rule . checkConformance ( node , errorReporter ) ; } // always visit all children return VisitDirective . CONTINUE ; } } ) ; }
Performs the overall check .