Home

Boolean literals should not be redundant

Rule description

  • Boolean literals should not be redundant

 

Non-compliant Code Example

DECLARE flag BOOLEAN := TRUE;
BEGIN
  IF flag = FALSE THEN  --Non compliant code (Boolean literals is redundant)                    
    DBMS_OUTPUT.PUT_LINE('flag is false!');
  ELSIF flag = TRUE THEN  --Non compliant code (Boolean literals is redundant)                         
    DBMS_OUTPUT.PUT_LINE('flag is true!');
  END IF;
END;

Compliant Code Example

DECLARE flag BOOLEAN := TRUE;
BEGIN
  IF NOT flag THEN   --Compliant code                     
    DBMS_OUTPUT.PUT_LINE('flag is false!');
  ELSIF flag THEN     --Compliant code                       
    DBMS_OUTPUT.PUT_LINE('flag is true!');
  END IF;
END;
Visual Expert 2020
 VEPLSQLRULE128