Several statements on a single line

CachéQuality release 
1.0.0
Id 
OS0057
Rule type 
Severity 

Major

Major
SQALE characteristic 
  • Maintainability
    • Readability
Tags 
clarity, coding-guidelines, confusing
Remediation function 
Constant/issue
Remediation cost 
10min

ObjectScript does allow more than one statement on the same line, and in fact if you use legacy flow control statements (which you shouldn't, really) you even have to put more than one statement on a same line.

However, this can lead to quite confusing code; recall that statements have no delimiters bewteen them other than spacing. Consider:

    // If c is true, write variable "x" then quit
    if c w x q

Or:

    // Create a variable named x, then invoke a method on it
    set x = ##class(some.Class).%New() do x.someMethod()

For readability reasons, it is therefore strongly recommended to always put statements on different lines.