Skip to content

[java] Cyclo metric should count conditions of for statements correctly #1483

@oowekyala

Description

@oowekyala

E.g.

           class Foo {
                private static int compareImports(String import1, String import2) {
                    for (int i = 0; i != import1Tokens.length && i != import2Tokens.length; i++) {
                    }
                }
            }

The current implementation counts the complexity of the expression in the initializer int i = 0 instead of the boolean expression:

int boolCompFor = CycloMetric.booleanExpressionComplexity(node.getFirstDescendantOfType(ASTExpression.class));

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:bugPMD crashes or fails to analyse a file.in:metricsAffects the metrics framework

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions