Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[java] CyclomaticComplexityRule counts ?-operator twice #1217
Affects PMD Version: 6.5.0
Description: CyclomaticComplexityRule counts conditional ternary operator twice. I believe this is incorrect, as it just adds one code path and can be rewritten as an if-else statement which just has complexity 1.
Code Sample demonstrating the issue:
Running PMD through: CLI
Example of output:
PMD reports a complexity of 3, where I believe it should be 2: one for the method entry, and one for the ?-operator.