Cyclomatic Complexity in piece of code with multiple exit points

前端 未结 3 847
隐瞒了意图╮
隐瞒了意图╮ 2021-02-09 15:38

I have this method that validates a password:

/**
 * Checks if the given password is valid.
 * 
 * @param password The password to validate.
 * @return {@code tr         


        
3条回答
  •  忘掉有多难
    2021-02-09 16:39

    I think the trick is that the logical operators are counted.

    Based off of your Metrics link (http://metrics.sourceforge.net/) under the McCabe Cyclomatic Complexity section:

    1 Initial flow

    3 decision points (if,for,if)

    3 conditional logic operators (||,||,||)

    total: 7

提交回复
热议问题