-
Notifications
You must be signed in to change notification settings - Fork 236
If a commented line inside R code contains 2 straight single quotes, document() throws erroneous warning #428
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
I should note, the toughest part about this was that the warning is ascribed to the roxygen block ABOVE the actual R code which is causing it. There are no mis-matched braces or quotes in the examples block, which is SUPER confusing. If the warning correctly identified the line where the error was (in the R code, not the roxygen block), this would have been much easier to figure out. |
(I'm responsible for this.) It shouldn't be too hard to add a compatibility switch, if this causes too much trouble. However, changing the comment from |
Ok, but note that if the sentence includes ANY subsequent
|
Yes, because that's not valid R code |
Isn't it technically not valid R appears to have no problem with it. |
You're generating #' @examples
#' testFun(x)
#' Warning1' Which makes: testFun(x)
warning1' which is not valid |
Completely agree. But the fact that I see what you're saying, and perhaps it's the right thing in the long run. I personally don't see a use case where I write roxygen documentation inside the function (could you share an example use case?). It ate up most of my day yesterday, fixing files with |
As I said in the other thread, it's a step along the road to support for R6 and RC. We didn't expect people to use roxygen comments instead of normal comments inside functions and unfortunately it's hard to get a more informative error message because of the way parsing works. |
Here's a simple sed -r -i"" "s/( +#)'/\1/" R/* Run it from your package's directory. I've tested it on Ubuntu, I hope I got the |
@krlmlr Thank you, that's very helpful. I appreciate the effort. I've actually fixed everything already, but I'm sure others will benefit from that. Perhaps a stack-overflow question that you ask and answer? |
You ask, I answer ;-) |
Produces
The text was updated successfully, but these errors were encountered: