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

Report error when file does not end with a newline character #47

Open
andreasabel opened this issue Feb 17, 2023 · 1 comment
Open

Report error when file does not end with a newline character #47

andreasabel opened this issue Feb 17, 2023 · 1 comment
Labels
error reporting Concering errors reported by fix-whitespace
Milestone

Comments

@andreasabel
Copy link
Member

Lifted from #44 (comment).

The following violation type does not produce an error:

* Ensure that the file ends in a newline character.

Reason: After breaking the file into lines, we cannot observe anymore whether the last line ended in a newline character. So maybe we have to implement our own line-breaking function which gives an error if the last line does not end with newline.

@andreasabel andreasabel added the error reporting Concering errors reported by fix-whitespace label Feb 17, 2023
@andreasabel andreasabel added this to the 0.1 milestone Feb 17, 2023
@ulysses4ever
Copy link
Contributor

"our own line-breaking function" sounds a bit too much. Isn't just checking the last byte of the file enough? If the byte is \n (modulo cross-platform considerations), then the file doe not violate that requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error reporting Concering errors reported by fix-whitespace
Projects
None yet
Development

No branches or pull requests

2 participants