View Javadoc

    1   /**
    2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
    3    */
    4   package net.sourceforge.pmd.lang.java.rule.codesize;
    5
    6   import net.sourceforge.pmd.lang.java.ast.ASTFormalParameter;
    7   import net.sourceforge.pmd.lang.java.ast.ASTFormalParameters;
    8   import net.sourceforge.pmd.lang.java.rule.design.ExcessiveNodeCountRule;
    9   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  }