The difficulty of understanding an expression increases for each of the And
, Or
and Xor
operators it
contains.
A single expression’s complexity should not become too high to keep the code readable.
Noncompliant code example
With the default threshold value of 3
If ( (condition1 And condition2) Or (condition3 And condition4) Or (condition5 And condition6) )
...
End If
Compliant solution
If ( myFirstCondition() Or mySecondCondition() Or myThirdCondition() )
...
End If