ExcessiveParameterListRule.java
01 /**
02  * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
03  */
04 package net.sourceforge.pmd.lang.java.rule.codesize;
05 
06 import net.sourceforge.pmd.lang.java.ast.ASTFormalParameter;
07 import net.sourceforge.pmd.lang.java.ast.ASTFormalParameters;
08 import net.sourceforge.pmd.lang.java.rule.design.ExcessiveNodeCountRule;
09 import net.sourceforge.pmd.util.NumericConstants;
10 
11 /**
12  * This rule detects an abnormally long parameter list.
13  * Note:  This counts Nodes, and not necessarily parameters,
14  * so the numbers may not match up.  (But topcount and sigma
15  * should work.)
16  */
17 public class ExcessiveParameterListRule extends ExcessiveNodeCountRule {
18     public ExcessiveParameterListRule() {
19         super(ASTFormalParameters.class);
20         setProperty(MINIMUM_DESCRIPTOR, 10d);
21     }
22 
23     // Count these nodes, but no others.
24     public Object visit(ASTFormalParameter node, Object data) {
25         return NumericConstants.ONE;
26     }
27 }