Skip to content

Commit

Permalink
style and docs: run devtools::document() and styler::style_pkg()
Browse files Browse the repository at this point in the history
  • Loading branch information
k-doering-NOAA committed Dec 19, 2024
1 parent 4562601 commit 250f3db
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions R/rm_dollar_sign.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,18 @@ rm_dollar_sign <- function(file,
mod_lines
)
if (allow_recursive) {
mod_lines <- recursive_replace(pattern = pattern_no_backtick_in_quotes,
replace = replace_no_backtick_in_quotes, lines = mod_lines, max_loops = max_loops)
} else {
if (length(grep(pattern_no_backtick_in_quotes, x = mod_lines)) > 0) {
warning(
"There are lists in lists in quotes, but allow_recursive = FALSE, so not all",
"dollar sign operators were converted."
mod_lines <- recursive_replace(
pattern = pattern_no_backtick_in_quotes,
replace = replace_no_backtick_in_quotes, lines = mod_lines, max_loops = max_loops
)
} else {
if (length(grep(pattern_no_backtick_in_quotes, x = mod_lines)) > 0) {
warning(
"There are lists in lists in quotes, but allow_recursive = FALSE, so not all",
"dollar sign operators were converted."
)
}
}
}

pattern_no_backtick <-
"([[:alnum:]]|\\.|\\_|\\]|\\(|\\))\\$([[:alnum:]]+)(([[:alnum:]]|\\.|\\_)*)(\\s|[[:punct:]]|$)"
Expand All @@ -95,8 +97,10 @@ rm_dollar_sign <- function(file,
mod_lines
)
if (allow_recursive) {
mod_lines <- recursive_replace(pattern = pattern_no_backtick,
replace = replace_no_backtick, lines = mod_lines, max_loops = max_loops)
mod_lines <- recursive_replace(
pattern = pattern_no_backtick,
replace = replace_no_backtick, lines = mod_lines, max_loops = max_loops
)
} else {
if (length(grep(pattern_no_backtick, x = mod_lines)) > 0) {
warning(
Expand Down Expand Up @@ -129,4 +133,4 @@ recursive_replace <- function(pattern, replace, lines, max_loops) {
)
}
lines
}
}

0 comments on commit 250f3db

Please sign in to comment.