View Javadoc
1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.lang.plsql.rule.codesize;
5   
6   import net.sourceforge.pmd.lang.plsql.ast.ExecutableCode;
7   import net.sourceforge.pmd.stat.DataPoint;
8   
9   /**
10   * Non-commented source statement counter for methods.
11   * 
12   * Analogous to and cribbed from {@link net.sourceforge.pmd.lang.java.rule.codesize.NcssMethodCountRule}.
13   */
14  public class NcssMethodCountRule extends AbstractNcssCountRule {
15  
16      /**
17       * Count the size of all non-constructor methods.
18       */
19      public NcssMethodCountRule() {
20  	super(ExecutableCode.class);
21  	setProperty(MINIMUM_DESCRIPTOR, 100d);
22      }
23  
24      @Override
25      public Object visit(ExecutableCode node, Object data) {
26  	return super.visit(node, data);
27      }
28  
29      @Override
30      public Object[] getViolationParameters(DataPoint point) {
31  	return new String[] { ((ExecutableCode) point.getNode()).getMethodName(),
32  		String.valueOf((int) point.getScore()) };
33      }
34  }