Missing parentheses in the Boolean expression

CachéQuality release 
1.3.0
Id 
OS0085
Rule type 
Severity 

Minor

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

Use parenthesis to surround the boolean expressions in a conditional statement.

Noncompliant Code Example

ClassMethod foo()
{
    Set a=1
    Set b=2

    if a=1 || b=2
    {
        Write !,"Hello "
    }
    Write !,"World"
}

Compliant Solution

ClassMethod foo()
{
    Set a=1
    Set b=2

    if (a=1) || (b=2)
    {
        Write !,"Hello "
    }
    Write !,"World"
}