This rule verifies that single-line comments are not located at the end of a line of code. The main idea behind this rule is that in order to be really readable, trailing comments would have to be property 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.

However, this rule allows to write trailing "metadata comments" - for which the pattern is configurable, as those metadata comments are usually very short and heavily used in some cases.

// The following line is non-compliant
int a1 = b + c; // This is a trailing comment that can be very very long

// This very long comment is better placed before the line of code
int a2 = b + c;

// The following line is compliant with the default configuration of the rule
String a3 = "id"; // $NON-NLS-1$