diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/metrics/rule/CyclomaticComplexityRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/metrics/rule/CyclomaticComplexityRule.java index 6a6f34bf2e..dbe3a29cf8 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/metrics/rule/CyclomaticComplexityRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/metrics/rule/CyclomaticComplexityRule.java @@ -30,10 +30,10 @@ import net.sourceforge.pmd.lang.rule.properties.IntegerProperty; public class CyclomaticComplexityRule extends AbstractJavaMetricsRule { private static final IntegerProperty CLASS_LEVEL_DESCRIPTOR = new IntegerProperty( - "classReportLevel", "Total class complexity reporting threshold", 1, 200, 40, 1.0f); + "classReportLevel", "Total class complexity reporting threshold", 1, 600, 80, 1.0f); private static final IntegerProperty METHOD_LEVEL_DESCRIPTOR = new IntegerProperty( - "methodReportLevel", "Cyclomatic complexity reporting threshold", 1, 30, 10, 1.0f); + "methodReportLevel", "Cyclomatic complexity reporting threshold", 1, 50, 10, 1.0f); private static final Map VERSION_MAP; diff --git a/pmd-java/src/main/resources/rulesets/java/metrics.xml b/pmd-java/src/main/resources/rulesets/java/metrics.xml index 1b6ee14b93..eae9f6807e 100644 --- a/pmd-java/src/main/resources/rulesets/java/metrics.xml +++ b/pmd-java/src/main/resources/rulesets/java/metrics.xml @@ -25,7 +25,9 @@ details on the calculation, see the documentation of the [Cyclo metric](/pmd_java_metrics_index.html#cyclomatic-complexity-cyclo). Generally, numbers ranging from 1-4 denote low complexity, 5-7 denote moderate complexity, 8-10 denote - high complexity, and 11+ is very high complexity. + high complexity, and 11+ is very high complexity. By default, this rule reports methods with a complexity >= 10. + Additionnally, classes with many methods of moderate complexity get reported as well once the total of their + methods' complexities reaches 80, even if none of the methods was directly reported. Reported methods should be broken down into several smaller methods. Reported classes should probably be broken down into subcomponents.