-
Notifications
You must be signed in to change notification settings - Fork 107
yapf code formatting deletes file if it does not parse #61
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
Comments
Eesh, sounds like it's not checking exit code. Should be an easy fix. |
Fixes #61: Catch yapf errors instead of overwriting file
This is still happening to me, but as a result of a strange corner case. I installed $ ~/miniconda3/envs/mapping/bin/yapf
-bash: /home/scott/miniconda3/envs/mapping/bin/yapf: /home/scott/miniconda3/envs/mapping/bin/python3.6: bad interpreter: No such file or directory It's definitely this same issue, as when I change the line Also, I was able to solve this by uninstalling yapf and reinstalling, so that the bad interpreter error went away, but it seemed worth noting here. |
I suspect the remaining issue is that it's returning a non-zero exit code besides |
Bad interpreter is exit code 126 |
Yup, that's what I was seeing. I'm going to go ahead and loosen that |
If you have a file that does not parse correctly by Python, yapf returns an error, and does not print anything to stdout. codefmt reads the stdout from yapf, and replaces the vim buffer with it, which means that a file with the below contents (note the missing end quote)
will be emptied when codefmt is run.
The text was updated successfully, but these errors were encountered: