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  // FUTURE Rename to ExcessiveParameterListRule
    17  public class LongParameterListRule extends ExcessiveNodeCountRule {
    18      public LongParameterListRule() {
    19          super(ASTFormalParameters.class);
    20      }
    21
    22      // Count these nodes, but no others.
    23      public Object visit(ASTFormalParameter node, Object data) {
    24          return NumericConstants.ONE;
    25      }
    26  }