Class CycloMetric
- java.lang.Object
-
- net.sourceforge.pmd.lang.metrics.AbstractMetric<N>
-
- net.sourceforge.pmd.lang.java.metrics.AbstractJavaMetric<MethodLikeNode>
-
- net.sourceforge.pmd.lang.java.metrics.impl.AbstractJavaOperationMetric
-
- net.sourceforge.pmd.lang.java.metrics.impl.CycloMetric
-
- All Implemented Interfaces:
JavaOperationMetric
,Metric<MethodLikeNode>
public final class CycloMetric extends AbstractJavaOperationMetric
Cyclomatic Complexity. See the documentation site.- Since:
- June 2017
- Author:
- Clément Fournier
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CycloMetric.CycloOption
Options for CYCLO.
-
Constructor Summary
Constructors Constructor Description CycloMetric()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
booleanExpressionComplexity(Node expr)
Evaluates the number of paths through a boolean expression.double
computeFor(MethodLikeNode node, MetricOptions options)
-
Methods inherited from class net.sourceforge.pmd.lang.java.metrics.impl.AbstractJavaOperationMetric
supports, supports
-
Methods inherited from class net.sourceforge.pmd.lang.metrics.AbstractMetric
equals, hashCode
-
-
-
-
Method Detail
-
computeFor
public double computeFor(MethodLikeNode node, MetricOptions options)
-
booleanExpressionComplexity
public static int booleanExpressionComplexity(Node expr)
Evaluates the number of paths through a boolean expression. This is the total number of&&
and||
operators appearing in the expression. This is used in the calculation of cyclomatic and n-path complexity.- Parameters:
expr
- Expression to analyse- Returns:
- The number of paths through the expression
-
-