Home

IF statement conditions should not evaluate unconditionally to TRUE or to FALSE

Rule description

  • IF statement conditions should not evaluate unconditionally to TRUE or to FALSE

 

Non-compliant Code Example

function string TestFunctionaCall (string cnt)

if true then //Non compliant code
	messagebox('true')
end if

if false then //Non compliant code
	messagebox('false')
end if

return cnt

end function

Compliant Code Example

function string TestFunctionaCall (string cnt)

if cnt == 'true' then //Compliant code
	messagebox('true')
end if

if cnt == 'false' then //Compliant code
	messagebox('false')
end if

return cnt

end function
Visual Expert 2020
 VEPBRULE42