inaka / elvis_core

The core of an Erlang linter
Other
57 stars 55 forks source link

New rule: Redundant Blank Lines #296

Open paulo-ferraz-oliveira opened 1 year ago

paulo-ferraz-oliveira commented 1 year ago

Name

redundant_blank_lines

Brief Description

Files should not have two or more consecutive blank lines.

Reasoning

This is not a technical concern, but you can improve the odds of others reading and liking your code by making it easier to follow.

Refactoring Proposal

elvis should warn that multiple blank lines are found in a given file (even if they are made up of trailing whitespace)

Options

max_lines (defaults to 1) should determine the number of consecutive blank lines that are allowed (1 means that a warning would occur for 2 blank lines in a row).

Note: if you're using a formatter, this could/should be a concern for it, also.

Origin (#281)

Inspired by Credo's https://hexdocs.pm/credo/Credo.Check.Readability.RedundantBlankLines.html.

elbrujohalcon commented 1 year ago

Don't forget to put an option to specify how many lines are too many lines ;)

paulo-ferraz-oliveira commented 1 year ago

Oh, Ok. I though two lines in a row would be too many already. (edit: edited the description, above)