Not sure if this is intentional, but the end-of-file fixer adds an extra line if the final line has spaces. Technically, combined with the trailing-whitespace check and running two passes, it would eventually fix it, but since it's called end-of-file-fixer perhaps it should handle this case on its own? I could put up a PR if you think it's worth fixing
You would actually have to run and stage twice. It would first add the extra line, then the trailing space would be removed from the second-to-last line, so you'd end up with 2 newlines at the end
Not sure if this is intentional, but the end-of-file fixer adds an extra line if the final line has spaces. Technically, combined with the
trailing-whitespace
check and running two passes, it would eventually fix it, but since it's calledend-of-file-fixer
perhaps it should handle this case on its own? I could put up a PR if you think it's worth fixingFile with spaces on last line:
After running
end-of-file-fixer
(added a line):With pre-commit hooks in this order:
You would actually have to run and stage twice. It would first add the extra line, then the trailing space would be removed from the second-to-last line, so you'd end up with 2 newlines at the end
After running with first pass: