-
Notifications
You must be signed in to change notification settings - Fork 30
Description
We've seen a number of issues where people try air format <file>.qmd or air format <file>.Rmd and it either:
- Gives you an obscure parse error
- "Works" because by chance it parses, but totally breaks your qmd
This occurs because right now if you provide air format <any-file> then we just blindly assume you know what you are doing and try to format that file. That's mostly to support something like air format NAMESPACE or air format r-text.txt or air format r-file-no-ext.
I think we should reconsider this, and maybe force "directly supplied" files to also be subject to default-include, which today is just "**/*.[R,r]", so it would limit Air to only being able to format R files at the command line. If we came across something that isn't "included", like <file>.qmd, then we'd either:
- Throw it out silently
- Throw it out with a warning, because the user clearly wanted to try and format this but we said no
- Totally error out, because the user clearly wanted to try and format this but we said no
The stdin case is even more ambiguous. We could:
- Reemit asis silently
- Reemit asis with a warning
- Totally error out
I would be in favor of switching to erroring out, as I think it would catch a lot of incorrect calls to air
I would also be in favor of not even providing a way to "force" air to format this non-R file, as I have never needed to do that and can't think of a compelling enough use case for it.
If we decide we can't do this, we should at least black list .qmd and .rmd when they are provided directly at the command line and error on those in particular.