Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New rule: Consistent Trailing Blank Line #295

Open
paulo-ferraz-oliveira opened this issue Mar 1, 2023 · 3 comments
Open

New rule: Consistent Trailing Blank Line #295

paulo-ferraz-oliveira opened this issue Mar 1, 2023 · 3 comments
Labels
Milestone

Comments

@paulo-ferraz-oliveira
Copy link
Collaborator

paulo-ferraz-oliveira commented Mar 1, 2023

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.

@paulo-ferraz-oliveira paulo-ferraz-oliveira changed the title Consistent Trailing Blank Line New rule: Consistent Trailing Blank Line Mar 1, 2023
@elbrujohalcon
Copy link
Member

Don't forget to add an option to specify the expected trailing line style.

@elbrujohalcon elbrujohalcon added this to the 3.1.0 milestone Mar 1, 2023
@paulo-ferraz-oliveira
Copy link
Collaborator Author

paulo-ferraz-oliveira commented Mar 1, 2023

You mean like \n or \r\n? (edit: check the description above)

@elbrujohalcon
Copy link
Member

Yeah.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants