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

insert_final_newline = true and empty files #416

Closed
ppalaga opened this issue Dec 18, 2019 · 3 comments
Closed

insert_final_newline = true and empty files #416

ppalaga opened this issue Dec 18, 2019 · 3 comments
Labels

Comments

@ppalaga
Copy link

ppalaga commented Dec 18, 2019

I wonder how an editorconfig processor should behave with insert_final_newline = true for an empty file? Should it (a) leave it as is or (b) should it add a line separator?

Background

My editorconfig-maven-plugin currently requires the line delimiter even in empty files and I got a user report claiming that the behavior is not compatible with some python tooling.

When searching for some editorconfig recommendations in this area, I just found a similar unresolved eclint issue jednano/eclint#156
So I guess there is no editorconfig-wide consensus about the matter.

Solution proposal

I understand the insert_final_newline as a means for enforcing files to comply with the POSIX definition of text file That definition explicitly says that it

allows a file with a single , or a totally empty file, to be called a text file.

So I think it should be OK to let an editorconfig processor to leave an empty file as is even with insert_final_newline = true

WDYT?

@cxw42
Copy link
Member

cxw42 commented Dec 18, 2019

I agree that a zero-byte file does not need a newline added to it.

@randstr
Copy link

randstr commented Dec 21, 2019

Definitely option a) leave it as is. It's the only sensible behavior IMO.

@ppalaga
Copy link
Author

ppalaga commented Dec 23, 2019

Thanks, I went with the option (a) - leave empty files as they are.

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

3 participants