[java:S113] Improve description

Qube: Community 9.9

The Java rule S113 has a wrong description. The point about this nice rule is, that all lines consist of the content and a linefeed. And this applies to the very last line a well.

So, if the last linefeed is missing, not an empty line is missing, but the last linefeed.

A line exists, if it ends with a linefeed. If there is a linefeed, but nothing before it, the line is empty. If there is nothing after the last linefeed, there is no line after it, not even an empty line.

Wrong:
Files should contain an empty newline at the end

Better:
Files should end with a newline

Wrong:
Some tools work better when files end with an empty line.

Better:
Some tools work better when the last line is complete (with a newline).

2 Likes

Hey Marvin,
thanks for the attention you put into our rule descriptions, we are always trying to make them clearer and more educational.

I agree with you on the first point, “Files should end with a newline” is more concise and also more conceptually correct I think.

As for the second, I think it would be better to be coherent with the form used in the former, with something like:
“Some tools work better when files end with a newline”

What do you think?

1 Like

Yey, sure. That sounds better.

1 Like