You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[java] Cognitive Complexity threshold cannot be set to 0 #5917
Description: The threshold value must be $s>0$. If $s=0$, the analysis does not return any files. For this reason, very simple Java files cannot be introduced into the final report.
Code Sample: The class below isn't include in the final PMD report.
Yes, exactly. This can be useful when you need to correlate metrics like CC with other information to obtain a complex report. In my case study, for example, I correlate each file with the contribution percentage of each developer that worked on that file and the CC of the file (e.g., like this csv).
My idea is that if 1 is allowed as a threshold value, why not also allow 0? In situations where you only want to find complex classes, 1 is probably too low a threshold value and not very interesting. Introducing 0 as a threshold value makes it easier to merge multiple analyses (as in my case study).
Activity
adangel commentedon Jul 18, 2025
Do I understand this correctly? Your use case is not finding complex classes, instead it is getting the metric for each class?
This reminds me of #5166 ...
edoardosarri24 commentedon Jul 18, 2025
Yes, exactly. This can be useful when you need to correlate metrics like CC with other information to obtain a complex report. In my case study, for example, I correlate each file with the contribution percentage of each developer that worked on that file and the CC of the file (e.g., like this csv).
My idea is that if 1 is allowed as a threshold value, why not also allow 0? In situations where you only want to find complex classes, 1 is probably too low a threshold value and not very interesting. Introducing 0 as a threshold value makes it easier to merge multiple analyses (as in my case study).