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

Cran compliance #14

Merged
merged 9 commits into from
Aug 28, 2024
Merged

Cran compliance #14

merged 9 commits into from
Aug 28, 2024

Conversation

radbasa
Copy link
Collaborator

@radbasa radbasa commented Aug 27, 2024

Have you read the Contributing Guidelines?

Address CRAN comments on package submission.

Description

Clear and concise description of what changed and why.
If necessary, include screenshots and/or a step-by-step guide on how to test the changes.

Definition of Done

  • The change is thoroughly documented.
  • The CI passes (R CMD check, linter, unit tests, spelling).
  • Any generated files have been updated (e.g. .Rd files with roxygen2::roxygenise())

@radbasa
Copy link
Collaborator Author

radbasa commented Aug 27, 2024

language_client <- function(working_dir = getwd(), diagnostics = FALSE, capabilities = NULL) {
withr::local_dir(working_dir)
withr::local_file(".Rprofile", {
if (testthat::is_checking()) {
parser_code <- c(
"box_use_parser <-",
deparse(box.lsp::box_use_parser)
)
rprofile <- readLines(fs::path_package("box.lsp", "Rprofile.R"))
} else {
source(fs::path(rprojroot::find_package_root_file(), "R", "box_lsp.R"), local = TRUE)
parser_code <- c(
"box_use_parser <-",
deparse(box_use_parser)
)
rprofile <- readLines(fs::path(rprojroot::find_package_root_file(), "inst", "Rprofile.R"))
rprofile <- sub("box.lsp::", "", rprofile)
}
write(parser_code, ".Rprofile", append = TRUE)
write(rprofile, ".Rprofile", append = TRUE)
readLines(".Rprofile")
})

CRAN might be flagging this because we are writing .Rprofile to getwd(). We need our custom .Rprofile in the working directory for the language server to use our custom box parser in

client$start(working_dir = working_dir, capabilities = capabilities)

R/utils.R Outdated
)
response <- substr(response, 1, 1)
if (!(response == "Y" || response == "y")) {
cli::cli_abort("`{file_path}` file creation/modification cancelled!")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't set this as an error. Info + early return?

R/utils.R Outdated
#' use_box_lsp()
#' }
#'
#' @export
use_box_lsp <- function(file_path = ".Rprofile") {
response <- readline(
glue::glue("Would you like to create or modify the `{file_path}` file? (yes/No) ")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel being more specific with the action would be better for the UX. In case when .Rprofile exists, you could ask for modification and mention, that the lines will be added and the original part will be preserved. And in the case when there is no Rprofile, that it will be created.


## R CMD check results

0 errors | 0 warnings | 1 note
Copy link
Collaborator Author

@radbasa radbasa Aug 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would 1 note be an issue?

@radbasa radbasa merged commit 2a3ca0d into main Aug 28, 2024
5 checks passed
@jakubnowicki jakubnowicki deleted the cran-compliance branch September 12, 2024 07:11
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

Successfully merging this pull request may close these issues.

2 participants