Home
Boolean checks should not be inverted
Rule description
- Boolean checks should not be inverted
Non-compliant Code Example
function string TestFunctionCall(string cnt) if NOT cnt <> 1 then //Non compliant code messagebox('cnt not equals to 1') end if if NOT(cnt = 1) then //Non compliant code messagebox('cnt equals to 1') end if if NOT cnt then messagebox('not cnt') end if return cnt end function
Compliant Code Example
function string TestFunctionCall(string cnt) if (cnt = 1) then //Compliant code messagebox('cnt not equals to 1') end if if (cnt <> 1) then //Compliant code messagebox('cnt equals to 1') end if if NOT cnt then messagebox('not cnt') end if return cnt end function