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.ASTSwitchStatement;
7 import net.sourceforge.pmd.lang.java.ast.JavaNode;
8
9
10 /**
11 * Implements the modified cyclomatic complexity rule
12 * <p>
13 * Modified rules: Same as standard cyclomatic complexity, but
14 * switch statement plus all cases count as 1.
15 *
16 * @author Alan Hohn, based on work by Donald A. Leckie
17 *
18 * @since June 18, 2014
19 */
20 public class ModifiedCyclomaticComplexityRule extends StdCyclomaticComplexityRule {
21
22 @Override
23 public Object visit(ASTSwitchStatement node, Object data) {
24 entryStack.peek().bumpDecisionPoints();
25 visit((JavaNode) node, data);
26 return data;
27 }
28
29 }