Skip to content

Commit 49e4dae

Browse files
committed
Mark regexes as fixed where possible
1 parent d69d813 commit 49e4dae

4 files changed

Lines changed: 12 additions & 11 deletions

File tree

.lintr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ linters: linters_with_defaults(
33
any_is_na_linter(),
44
outer_negation_linter(),
55
nzchar_linter(),
6+
fixed_regex_linter(),
67
object_name_linter = object_name_linter(styles = c("snake_case", "symbols", "CamelCase", "SNAKE_CASE"))
78
)

R/from_Seurat.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ from_Seurat <- function(
527527
next
528528
}
529529

530-
dest_name <- gsub(paste0(assay_name, "_"), "", graph_name)
530+
dest_name <- gsub(paste0(assay_name, "_"), "", graph_name, fixed = TRUE)
531531

532532
obsp_mapping[dest_name] <- graph_name
533533
}

R/generate_dataset.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,14 @@ generate_dataset <- function(
226226
factor(NA_character_, ordered = TRUE)
227227
} else if (uns_type == "scalar_logical_with_nas") {
228228
NA_real_
229-
} else if (grepl("scalar_", uns_type)) {
230-
generate_vector(1L, gsub("scalar_", "", uns_type))
231-
} else if (grepl("vec_", uns_type)) {
232-
generate_vector(10L, gsub("vec_", "", uns_type))
233-
} else if (grepl("df_", uns_type)) {
234-
generate_dataframe(10L, gsub("df_", "", uns_type))
235-
} else if (grepl("mat_", uns_type)) {
236-
generate_matrix(10L, 10L, gsub("mat_", "", uns_type))
229+
} else if (grepl("scalar_", uns_type, fixed = TRUE)) {
230+
generate_vector(1L, gsub("scalar_", "", uns_type, fixed = TRUE))
231+
} else if (grepl("vec_", uns_type, fixed = TRUE)) {
232+
generate_vector(10L, gsub("vec_", "", uns_type, fixed = TRUE))
233+
} else if (grepl("df_", uns_type, fixed = TRUE)) {
234+
generate_dataframe(10L, gsub("df_", "", uns_type, fixed = TRUE))
235+
} else if (grepl("mat_", uns_type, fixed = TRUE)) {
236+
generate_matrix(10L, 10L, gsub("mat_", "", uns_type, fixed = TRUE))
237237
} else {
238238
cli_abort("Unknown {.field uns} type: {.val {uns_type}}")
239239
}

vignettes/articles/development_status.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ source <- list.files(proj_root, pattern = "*.R$", recursive = TRUE)
2828
# look for trackstatus comments
2929
status_lines <- map_df(source, function(path) {
3030
lines <- readLines(paste0(proj_root, "/", path))
31-
line_numbers <- grep("# trackstatus:", lines)
31+
line_numbers <- grep("# trackstatus:", lines, fixed = TRUE)
3232
3333
map_df(line_numbers, function(line_number) {
3434
tryCatch(
@@ -200,7 +200,7 @@ for (i in seq_along(data)) {
200200
" * To investigate: ", data[[i]]$to_investigate, "\n",
201201
" * To fix: ", data[[i]]$to_fix, "\n\n",
202202
"### Error message\n\n",
203-
paste(paste0(" ", strsplit(data[[i]]$error_message, "\n")[[1]], "\n"), collapse = ""), "\n\n",
203+
paste(paste0(" ", strsplit(data[[i]]$error_message, "\n", fixed = TRUE)[[1]], "\n"), collapse = ""), "\n\n",
204204
"### Proposed solution\n\n",
205205
data[[i]]$proposed_solution, "\n\n"
206206
)

0 commit comments

Comments
 (0)