Skip to content

Commit

Permalink
some styler suggestions
Browse files Browse the repository at this point in the history
ref #498
  • Loading branch information
wibeasley committed Jul 14, 2023
1 parent e0a1451 commit 3c217b9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion R/constant.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#'
#' The current constants relate to the 'complete' variable at the
#' end of each form.
#' * `form_incomplete`: 0L (*i.e.*, an integer)
#' * `form_incomplete`: 0L (_i.e._, an integer)
#' * `form_unverified`: 1L
#' * `form_complete`: 2L
#'
Expand Down
4 changes: 2 additions & 2 deletions R/create-batch-glossary.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ create_batch_glossary <- function(row_count, batch_size) {

start_index <- as.integer(base::seq.int(from=1L, to=row_count, by=batch_size))

ds_batch <-
ds_batch <-
tibble::tibble(
id = seq_along(start_index),
start_index = start_index
)
ds_batch$stop_index <-
ds_batch$stop_index <-
base::mapply(
function(i) {
base::ifelse(
Expand Down
17 changes: 8 additions & 9 deletions R/kernel-api.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@
#' token <- "9A81268476645C4E5F03428B8AC3AA7B"
#' post_body <- list(
#' token = token,
#' content = 'project',
#' format = 'csv'
#' content = "project",
#' format = "csv"
#' )
#' \dontrun{
#' kernel <- REDCapR:::kernel_api(uri, post_body, config_options)
#'
#' # Consume the results in a few different ways.
#' kernel$result
#' read.csv(text=kernel$raw_text)
#' as.list(read.csv(text=kernel$raw_text))
#' read.csv(text = kernel$raw_text)
#' as.list(read.csv(text = kernel$raw_text))
#' }

kernel_api <- function(
Expand Down Expand Up @@ -83,9 +83,9 @@ kernel_api <- function(
httr::user_agent("OuhscBbmc/REDCapR")
)

status_code <- response$status
success <- (status_code == 200L)
raw_text <- httr::content(
status_code <- response$status
success <- (status_code == 200L)
raw_text <- httr::content(
x = response,
as = "text",
encoding = encoding, # UTF-8 is the default parameter value
Expand All @@ -104,7 +104,7 @@ kernel_api <- function(
any(grepl(regex_cannot_connect, raw_text)) #||
# any(grepl(regex_empty , raw_text))
) {
success <- FALSE # nocov
success <- FALSE # nocov
}

return(list(
Expand All @@ -114,7 +114,6 @@ kernel_api <- function(
elapsed_seconds = elapsed_seconds,
result = response,
result_headers = response$headers,

regex_empty = regex_empty
))
}
6 changes: 3 additions & 3 deletions R/metadata-utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@

#' @export
regex_named_captures <- function(pattern, text, perl = TRUE) {
checkmate::assert_character(pattern, any.missing=FALSE, min.chars=0L, len=1)
checkmate::assert_character(text , any.missing=FALSE, min.chars=0L, len=1)
checkmate::assert_logical( perl , any.missing=FALSE , len=1)
checkmate::assert_character(pattern, any.missing = FALSE, min.chars=0L, len=1)
checkmate::assert_character(text , any.missing = FALSE, min.chars=0L, len=1)
checkmate::assert_logical( perl , any.missing = FALSE, min.chars=0L, len=1)

match <- gregexpr(pattern, text, perl = perl)[[1]]
capture_names <- attr(match, "capture.names")
Expand Down

0 comments on commit 3c217b9

Please sign in to comment.