Skip to content

Commit

Permalink
Merge pull request #1217 from r-lib/saf
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil authored Jun 15, 2024
2 parents 790d45b + 434cbc5 commit 7b5327c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions .lintr
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ linters: all_linters(
todo_comment_linter = NULL,
nonportable_path_linter = NULL,
string_boundary_linter = NULL,
strings_as_factors_linter = NULL, # since we use R >= 4.0
undesirable_function_linter = NULL,
undesirable_operator_linter = NULL
)
Expand Down
3 changes: 1 addition & 2 deletions R/token-define.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ token <- rbind.data.frame(
c("if", "cond", "IF"),
c("else", "cond", "ELSE"),
c("in", "loop_cond", "IN"),
c("while", "loop_cond", "WHILE"),
stringsAsFactors = FALSE
c("while", "loop_cond", "WHILE")
)
# styler: on

Expand Down
3 changes: 1 addition & 2 deletions R/ui-caching.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ cache_info <- function(cache_name = NULL, format = "both") {
last_modified = suppressWarnings(max(file_info$mtime)),
created = file.info(path_cache)$ctime,
location = path_cache,
activated = cache_is_activated(cache_name),
stringsAsFactors = FALSE
activated = cache_is_activated(cache_name)
)

if (any(c("lucid", "both") == format)) {
Expand Down
4 changes: 2 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ re_match <- function(text, pattern) {
end <- start + length - 1L
matchstr <- substring(text, start, end)
matchstr[start == -1L] <- NA_character_
res <- data.frame(stringsAsFactors = FALSE, .text = text, .match = matchstr)
res <- data.frame(.text = text, .match = matchstr)

gstart <- attr(match, "capture.start")
glength <- attr(match, "capture.length")
gend <- gstart + glength - 1L
groupstr <- substring(text, gstart, gend)
groupstr[gstart == -1L] <- NA_character_
dim(groupstr) <- dim(gstart)
res <- cbind(groupstr, res, stringsAsFactors = FALSE)
res <- cbind(groupstr, res)

names(res) <- c(attr(match, "capture.names"), ".text", ".match")
res
Expand Down

0 comments on commit 7b5327c

Please sign in to comment.