Home
Two branches in a conditional structure should not have exactly the same implementation
Rule description
- Two branches in a conditional structure should not have exactly the same implementation
Non-compliant Code Example
BEGIN IF counter > 0 THEN cust_order := 1; message := 'Number is positive'; ELSIF counter > 100 THEN --Non compliant code (ElSEIF branch is having exactly the same implementation of IF branch) cust_order := 1; message := 'Number is positive'; ELSE cust_order := 0; message := 'Number is negative'; END IF; END;
Compliant Code Example
BEGIN IF counter > 0 THEN cust_order := 1; message := 'Number is positive'; ELSIF counter > 100 THEN --Compliant code (ElSEIF branch is having exactly the same implementation of IF branch) cust_order := 2; message := 'Number is positive'; ELSE cust_order := 0; message := 'Number is negative'; END IF; END;