Fixed divide by zero bug that would cause a large class complexity number.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1404 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -131,7 +131,7 @@ public class CyclomaticComplexityRule extends AbstractRule
|
||||
Entry classEntry = (Entry) m_entryStack.pop();
|
||||
double decisionPoints = (double) classEntry.m_decisionPoints;
|
||||
double methodCount = (double) classEntry.m_methodCount;
|
||||
int complexityAverage = (int) (Math.rint(decisionPoints / methodCount));
|
||||
int complexityAverage = (methodCount == 0) ? 1 : (int) (Math.rint(decisionPoints / methodCount));
|
||||
|
||||
if ((complexityAverage >= getIntProperty("reportLevel")) ||
|
||||
(classEntry.m_highestDecisionPoints >= getIntProperty("reportLevel")))
|
||||
|
Reference in New Issue
Block a user