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

Empty files should pass with insert_final_newline = true #43

Closed
vrevelas opened this issue Aug 20, 2019 · 3 comments
Closed

Empty files should pass with insert_final_newline = true #43

vrevelas opened this issue Aug 20, 2019 · 3 comments

Comments

@vrevelas
Copy link
Contributor

Empty files, such as __init__.py cause errors like __init__.py@1,1: Insert lf - violates insert_final_newline = true, reported by org.ec4j.linters.TextLinter when using a .editorconfig file like

root = true

[*]
end_of_line = lf
insert_final_newline = true

Adding a newline to these empty files as a workaround suppresses the error from this plugin, but then fails pylint checks (trailing-newlines check).

Excluding init.py files is also not ideal, as they are often empty, but sometimes contain code that should be checked.

I think the correct behaviour here would be to ignore empty files when checking for trailing newlines.

@ppalaga
Copy link
Collaborator

ppalaga commented Dec 18, 2019

This is an interesting corner case. Thanks for the report, @vrevelas. I asked about that in the editorconfig project editorconfig/editorconfig#416

@ppalaga ppalaga changed the title Empty files cause insert_final_newline error Empty files should pass with insert_final_newline = true Dec 22, 2019
@ppalaga
Copy link
Collaborator

ppalaga commented Dec 23, 2019

Fixed by upgrading to editorconfig-linters 0.1.2 131eb51

@ppalaga ppalaga closed this as completed Dec 23, 2019
@ppalaga
Copy link
Collaborator

ppalaga commented Dec 23, 2019

Fixed in the just released version 0.0.11. Thanks again for the report.

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

No branches or pull requests

2 participants