View Javadoc

1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.lang.vm.rule.basic;
5   
6   import net.sourceforge.pmd.lang.vm.ast.ASTprocess;
7   import net.sourceforge.pmd.lang.vm.rule.AbstractStatisticalVmRule;
8   import net.sourceforge.pmd.stat.DataPoint;
9   
10  public class ExcessiveTemplateLengthRule extends AbstractStatisticalVmRule {
11  
12      @Override
13      public Object visit(final ASTprocess node, final Object data) {
14          final DataPoint point = new DataPoint();
15          point.setNode(node);
16          point.setScore(1.0 * (node.getEndLine() - node.getBeginLine()));
17          point.setMessage(getMessage());
18          addDataPoint(point);
19          return node.childrenAccept(this, data);
20      }
21  }