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

Errors from black are shown as 'undefined' #23

Open
lassik opened this issue Jul 18, 2018 · 3 comments
Open

Errors from black are shown as 'undefined' #23

lassik opened this issue Jul 18, 2018 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@lassik
Copy link

lassik commented Jul 18, 2018

Using black natively:

$ echo 'if True:print 1' | black -
if True:print 1
error: cannot format -: cannot use --safe with this file; failed to parse source file with Python 3.7's builtin AST. Re-run with --fast or stop using deprecated Python 2 syntax. AST error message: Missing parentheses in call to 'print'. Did you mean print(1)? (<unknown>, line 1)
All done! 💥 💔 💥
1 file failed to reformat.

Same code using Unibeautify:

$ echo 'if True:print 1' | unibeautify --language Python
undefined
@Glavin001
Copy link
Member

Does black have a non-zero exit code?

$ echo 'if True:print 1' | black -
$ echo $?

And do you know if black uses stderr or is the error in stdout instead?

Looks like error handling is implemented but not tested: https://github.com/Unibeautify/beautifier-black/blob/master/src/index.ts#L85-L86

If black beautifier is working correctly this may be a Unibeautify CLI bug.

@Glavin001 Glavin001 added the bug Something isn't working label Oct 22, 2018
@lassik
Copy link
Author

lassik commented Oct 23, 2018

It should use non-zero exit codes properly and write errors to stderr. I don't have any special handling for it in the Emacs format-all package. I just call it as black -q -.

@Glavin001
Copy link
Member

[Black] should use non-zero exit codes properly and write errors to stderr.

Sounds like the problem is with Unibeautify CLI then not passing errors up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants