View Javadoc

1   /***
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.rules.design;
5   
6   import net.sourceforge.pmd.ast.ASTFormalParameter;
7   import net.sourceforge.pmd.ast.ASTFormalParameters;
8   import net.sourceforge.pmd.util.NumericConstants;
9   
10  /***
11   * This rule detects an abnormally long parameter list.
12   * Note:  This counts Nodes, and not necessarily parameters,
13   * so the numbers may not match up.  (But topcount and sigma
14   * should work.)
15   */
16  public class LongParameterListRule extends ExcessiveNodeCountRule {
17      public LongParameterListRule() {
18          super(ASTFormalParameters.class);
19      }
20  
21      // Count these nodes, but no others.
22      public Object visit(ASTFormalParameter node, Object data) {
23          return NumericConstants.ONE;
24      }
25  }