formatR
formatR copied to clipboard
tidy_source fails, Ctrl-Shift-A makes code non-running.
If I save the following code under the given filename, and run it, I get
Error in base::parse(text = code, keep.source = keep.source) :
<text>:17:1: unexpected symbol
16: invisible(".BeGiN_TiDy_IdEnTiFiEr_HaHaHa#quiet = TRUE,.HaHaHa_EnD_TiDy_IdEnTiFiEr")
17: output_format
When I run Ctrl-Shift-A in Rstudio, it puts the second last ')' in the line above (after the comment!)
# problem code for Ctrl-Shift-A:
# inner ')' is put in comment.
# with or without new line before #
#
if (!missing(report_fn))
{
reticulate::use_miniconda('r-reticulate')
message("writing fr report to:")
message(output_directory)
fr_report_time_period <- "2023"
render(
report_fn,
encoding = "UTF-8",
output_dir = output_directory,
#quiet = TRUE,
output_format = c("word_document", "pdf_document", "html_document" # , "odt_document" this does not work well
)
)
}
bug_report <- "/home/oliver/git/universal-supporter-analytics/bug_reports/format_code_problem.R"
tidy_source(bug_report)
R version 4.4.0 (2024-04-24)
Platform: x86_64-pc-linux-gnu
Running under: TUXEDO OS 3, RStudio 2024.4.0.735
Locale:
LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=de_DE.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=de_DE.UTF-8
LC_MESSAGES=en_US.UTF-8 LC_PAPER=de_DE.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C
Package version:
formatR_1.14.1
remark: TUXEDO OS is a flavour of Ubuntu 22.04
By filing an issue to this repo, I promise that
- [x] I have fully read the issue guide at https://yihui.org/issue/.
- [x] I have provided the necessary information about my issue.
- If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
- If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included
xfun::session_info('formatR'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('yihui/formatR'). - If I have posted the same issue elsewhere, I have also mentioned it in this issue.
- [X] I have learned the Github Markdown syntax, and formatted my issue correctly.
I understand that my issue may be closed if I don't fulfill my promises.
This is a known limitation: https://yihui.org/formatr/#6-further-notes
Thanks. Pretty scary though, that it killed the syntax. Important to know.