Skip to content

Commit

Permalink
More lintr and code styling
Browse files Browse the repository at this point in the history
  • Loading branch information
rmbielby committed Nov 11, 2024
1 parent 3d23dfd commit e18e029
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions R/diagnostic_test.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#' Diagnostic testing
#'
#' @description
#' Run a set of diagnostic tests to check for common issues found when setting up R on a DfE
#' Run a set of diagnostic tests to check for common issues found when setting
#' up R on a DfE
#' system. This includes:
#' - Checking for proxy settings in the Git configuration
#' - Checking for correct download method used by renv (curl)
Expand All @@ -27,8 +28,8 @@ diagnostic_test <- function(

#' Check proxy settings
#'
#' @param proxy_setting_names Vector of proxy parameters to check for. Default: c("http.proxy",
#' "https.proxy")
#' @param proxy_setting_names Vector of proxy parameters to check for. Default:
#' c("http.proxy", "https.proxy")
#' @param clean Attempt to clean settings
#' @param verbose Run in verbose mode
#'
Expand Down Expand Up @@ -89,8 +90,11 @@ check_renv_download_method <- function(
}
rdm_present <- .renviron %>% stringr::str_detect("RENV_DOWNLOAD_METHOD")
if (any(rdm_present)) {
dfeR::toggle_message("Found RENV_DOWNLOAD_METHOD in .Renviron:", verbose = verbose)
dfeR::toggle_message(message(" ", .renviron[rdm_present]), verbose = verbose)
dfeR::toggle_message(
"Found RENV_DOWNLOAD_METHOD in .Renviron:",
verbose = verbose
)
dfeR::toggle_message(" ", .renviron[rdm_present], verbose = verbose)
detected_method <- .renviron[rdm_present] |>
stringr::str_split("=") |>
unlist() |>
Expand All @@ -108,11 +112,16 @@ check_renv_download_method <- function(
"RENV_DOWNLOAD_METHOD=\"curl\""
)
cat(.renviron, file = renviron_file, sep = "\n")
message("FIXED: The renv download method has been set to curl in your .Renviron file.")
message(
paste0(
"FIXED: The renv download method has been set to curl in your ",
".Renviron file."
)
)
readRenviron(renviron_file)
} else {
message("If you wish to manually update your .Renviron file, follow these steps:")
message(" - Run the following command in the R console to open the .Renviron file:")
message("If you wish to manually update your .Renviron file:")
message(" - Run the command in the R console to open .Renviron:")
message(" usethis::edit_r_environ()")
if (any(rdm_present)) {
message(" - Remove the following line from .Renviron:")
Expand Down

0 comments on commit e18e029

Please sign in to comment.