google / google/yapf

yapf adds newline to end of file when reading source file from stdin

Open
#329 2 comments 3 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14k
Forks
904
PR merge metrics
No merged PRs in 30d

Description

As per #195, yapf shouldn't add a trailing newline to an empty file. It mostly doesn't, but if you run against stdin instead of a named file for some reason it does:

```
$ echo -n | yapf --style=pep8 | wc -c
1
$ touch empty
$ yapf --style=pep8 empty | wc -c
0
```

I tested this running against a2f034296536867f79e3843fb8cc3d5a90c941db under Python 3.5.1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.