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

What happens when formatting fails because of syntax error? #200

Open
etiennebacher opened this issue Jan 23, 2025 · 2 comments
Open

What happens when formatting fails because of syntax error? #200

etiennebacher opened this issue Jan 23, 2025 · 2 comments

Comments

@etiennebacher
Copy link

Suppose I have a file with a syntax error, e.g. 1 +. Currently air format . errors with

ERROR Failed to format foo.R: Failed to parse due to syntax errors.

It's not clear from this message if other files were still formatted or if this error stopped the formatting for the rest of the folder as well.

Basically:

  • if the error stopped formatting for other files, is it possible to prevent this behavior to only stop formatting for the file with the syntax error?
  • if the error didn't stop formatting for other files, can it be mentioned in the error messages? For example:

ERROR Failed to format foo.R: Failed to parse due to syntax errors.
ERROR Failed to format foo-bar.R: Failed to parse due to syntax errors.
ERROR Failed to format other-file.R: Failed to parse due to syntax errors.

Remaining files were correctly formatted.

@DavisVaughan
Copy link
Collaborator

DavisVaughan commented Jan 23, 2025

Other files are still formatted. Maybe it's worth saying Successfully formatted {n} files. unconditionally? And n would be total_files - errors. I think I'd like for us to try not to be too noisy though, so idk if that's really worth it.

@etiennebacher
Copy link
Author

Maybe it's worth saying Successfully formatted {n} files. unconditionally? And n would be total_files - errors.

Yes this could be enough, e.g.:

Formatted n files.

and

Formatted n files. Errors for x files:
format foo.R: Failed to parse due to syntax errors.
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants