Skip to content

Improve handling of duplicate classes and methods.

ci.jenkins.io / PMD failed Nov 14, 2023 in 0s

1 new issue

Total New Outstanding Fixed Trend
1 1 0 0 👎

Reference build: Plugins » coverage-model » main #72

Details

Severity distribution of new issues

Error Warning High Warning Normal Warning Low
0 0 1 0

Annotations

Check warning on line 120 in src/main/java/edu/hm/hafner/coverage/parser/CoberturaParser.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / PMD

CyclomaticComplexity

NORMAL:
The method 'parseReport(Reader, FilteredLog)' has a cyclomatic complexity of 10.
Raw output
The complexity of methods directly affects maintenance costs and readability. Concentrating too much decisional logic in a single method makes its behaviour hard to read and change. Cyclomatic complexity assesses the complexity of a method by counting the number of decision points in a method, plus one for the method entry. Decision points are places where the control flow jumps to another place in the program. As such, they include all control flow statements, such as `if`, `while`, `for`, and `case`. For more 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. By default, this rule reports methods with a complexity >= 10. Additionally, 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. <pre> <code> class Foo { void baseCyclo() { // Cyclo = 1 highCyclo(); } void highCyclo() { // Cyclo = 10: reported! int x = 0, y = 2; boolean a = false, b = true; if (a &amp;&amp; (y == 1 ? b : true)) { // +3 if (y == x) { // +1 while (true) { // +1 if (x++ &lt; 20) { // +1 break; // +1 } } } else if (y == t &amp;&amp; !d) { // +2 x = a ? y : x; // +1 } else { x = 2; } } } } </code> </pre> <a href="https://pmd.github.io/pmd-6.55.0/pmd_rules_java_design.html#cyclomaticcomplexity"> See PMD documentation. </a>