elvis_core
elvis_core copied to clipboard
New rule: Consistent Trailing Blank Line
Name
consistent_trailing_blank_line
Brief Description
Files should end in a single trailing blank line.
Reasoning
This is mostly for historical reasons: every text file should end with a \n, or newline since this acts as eol or the end of the line character.
See also: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
Most text editors ensure this "final newline" automatically.
Refactoring Proposal
elvis
should warn when such a line is missing or when multiple lines are present.
Note: this can also be considered a formatter issue, so shouldn't exist in your code base if you're using such an element.
Options
style
should be either windows
or unix
(for \r\n, or \n)
Origin (#281)
Inspired by Credo's Credo.Check.Readability.TrailingBlankLine.
Don't forget to add an option to specify the expected trailing line style.
You mean like \n or \r\n? (edit: check the description above)
Yeah.