-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
TrailingBlankLines should not trigger on empty file with single blank line #993
Comments
True. |
I get the following results when I run
I think it's wrong to report any offense for an empty file, while the report about encoding comment for |
@jonas054 is there any reason to add the encoding comment when there is no content (besides the (I'm using Ruby 2.1 myself, so didn't run into the warning you described) |
I guess it doesn't make sense to run cops on blank files. |
@bbatsov except for the ones that act on something other than the content (for example, the snake case naming one). |
Yep, you're totally right. |
@JeanMertz You have to draw the line somewhere. I'd like to draw it between an empty file and a non-empty file. If there is at least one character, then the file has an encoding. |
No there is no such classification, so we would need to introduce a special case for one cop in generic code. That's not so good. I prefer to fix the problem in |
[Fix #993] Don't report offenses for an empty file
Files with a single (empty) line should not trigger
TrailingBlankLines: Final newline missing.
.The text was updated successfully, but these errors were encountered: