I have this method that validates a password:
/**
* Checks if the given password is valid.
*
* @param password The password to validate.
* @return {@code tr
As nicely explained here :
Cyclomatic Complexity = ( 2 + ifs + loops +cases - return ) where:
* ifs is the number of IF operators in the function, * loops is the number of loops in the function, * cases is the number of switch branches in the function (without default), and * return is the number of return operators in the function.
As already mentioned, logical conditions are also calculated.
For example if (len < 8 || len > 20)
counts as 3 conditions :
if
len<8
len > 20
That means, that your code has complexity of 2 + 8 - 3 = 7
, where :