File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ source("inst/styler/bgms_style.R")
2929styler :: style_pkg(style = bgms_style )
3030```
3131
32+ After styling, check test files for assignment captures inside function
33+ calls, such as ` expect_message(result <- foo(), "pattern") ` . These must
34+ remain ` <- ` , because ` = ` would be interpreted as a named argument.
35+
3236## Documentation
3337
3438- ** Exported R functions** get full roxygen2 blocks (` @title ` ,
Original file line number Diff line number Diff line change @@ -13,13 +13,14 @@ bgms_style <- function() {
1313
1414 # "a <- 1" -> "a = 1"
1515 #
16- # Preserves <- inside function-call arguments, where = would be interpreted
17-
18- # as a named argument (e.g. expect_message(result <- foo(), "pattern")).
16+ # Preserves <<- everywhere and preserves <- inside function-call arguments,
17+ # where = would be interpreted as a named argument
18+ # (e.g. expect_message(result <- foo(), "pattern")).
1919 # Detection: the LHS expr's child node has token_before == "'('" when the
2020 # assignment sits inside a call's argument list.
2121 style $ token $ force_assignment_op <- function (pd ) {
2222 to_replace <- pd $ token %in% c(" EQ_ASSIGN" , " LEFT_ASSIGN" )
23+ to_replace [pd $ text == " <<-" ] <- FALSE
2324 if (any(to_replace & pd $ token == " LEFT_ASSIGN" )) {
2425 for (i in which(to_replace & pd $ token == " LEFT_ASSIGN" )) {
2526 lhs_row <- i - 1
You can’t perform that action at this time.
0 commit comments