This rule verifies that single-line comments are not located at the ends of lines of code. The main idea behind this rule is that in order to be
really readable, trailing comments would have to be properly written and formatted (correct alignment, no interference with the visual structure of
the code, not too long to be visible) but most often, automatic code formatters would not handle this correctly: the code would end up less readable.
Comments are far better placed on the previous empty line of code, where they will always be visible and properly formatted.
Noncompliant code example
With the default value for the legalTrailingCommentPattern
parameter: ^'\s*[^\s]+$
a = b + c ' This is a trailing comment that could be very very long -- Noncompliant
d = a + 9 REM This is another trailing comment which could be very very long -- Noncompliant
e = a * b ' FIXME -- allowed
Compliant solution
' This very long comment is better placed before the line of code
a = b + c
REM This is very long comment which is better placed before the line of code
d = a + 9
e = a * b ' FIXME