Boolean expression not surrounded by parentheses

CachéQuality release 
1.0.0
Id 
OS0001
Rule type 
Severity 

Minor

Minor
SQALE characteristic 
  • Reliability
    • Logic
Tags 
clarity, coding-guidelines
Remediation function 
Constant/issue
Remediation cost 
5min

ObjectScript's flow control keywords accepting boolean expressions (such as if, while and others) allow to write boolean expressions without surrounding parentheses; for instance:

    if x > 4 {
        write x, " is greater than 4", !
    }

However, such code is rather confusing for people coming from other languages (Java, C, C++, etc) where surrounding parenthese are required.

Since surrounding such expressions in ObjectScript has no ill effect on the behavior of those expressions, you may want to use surrounding parentheses:

    if (x > 4) {
        write x, " is greater than 4", !
    }