CA028 - Combine two if instructions

Description

Two nested instructions, both not having an else clause, could be combined into a single if instruction using the and then boolean operator.

Scope Instruction
Status Enabled
Severity Suggestion
Applicability All
Score 40

Example of violation

if user /= Void then if user.age >= 18 then ... end end

Recommendation

Combine the nested if instructions using and then. In the example, it becomes: if user /= Void and then user.age >= 18 then ... end

cached: 11/18/2024 2:06:14.000 PM