Skip to content

Commit ae51d8a

Browse files
[skip style] [skip vbump] Restyle files
1 parent 88a8c04 commit ae51d8a

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

R/qenv-eval_code.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ setGeneric("eval_code", function(object, code) standardGeneric("eval_code"))
2929

3030
setMethod("eval_code", signature = c("qenv", "character"), function(object, code) {
3131
parsed_code <- parse(text = code, keep.source = TRUE)
32-
if (length(parsed_code) == 0) return(object)
32+
if (length(parsed_code) == 0) {
33+
return(object)
34+
}
3335

3436
id <- sample.int(.Machine$integer.max, size = length(parsed_code))
3537

R/utils-get_code_dependency.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,8 @@ get_line_ids <- function(pd) {
494494
# If NUM_CONST is the last element, we need to reorder rows.
495495
# Last 2 rows
496496
n <- nrow(pd)
497-
if (pd$token[n-1] == "NUM_CONST" && pd$parent[n] == 0) {
498-
pd <- rbind(pd[-(n-1), ], pd[n-1, ])
497+
if (pd$token[n - 1] == "NUM_CONST" && pd$parent[n] == 0) {
498+
pd <- rbind(pd[-(n - 1), ], pd[n - 1, ])
499499
}
500500

501501
calls_start <- which(pd$parent == 0)

tests/testthat/test-qenv_get_code.R

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,8 @@ testthat::test_that("comments fall into proper calls", {
463463
q <- qenv() |> eval_code(code)
464464
testthat::expect_identical(
465465
get_code(q),
466-
c(" # initial comment\n a <- 1",
466+
c(
467+
" # initial comment\n a <- 1",
467468
" b <- 2 # inline comment",
468469
" c <- 3\n # inbetween comment",
469470
" d <- 4\n # finishing comment"
@@ -488,7 +489,8 @@ testthat::test_that("comments get pasted when they fall into calls", {
488489
q <- qenv() |> eval_code(code)
489490
testthat::expect_identical(
490491
get_code(q),
491-
c(" # initial comment\n a <- 1 # A comment",
492+
c(
493+
" # initial comment\n a <- 1 # A comment",
492494
" b <- 2 # inline comment",
493495
" c <- 3 # C comment\n # inbetween comment",
494496
" d <- 4\n # finishing comment"
@@ -634,8 +636,10 @@ testthat::test_that("detects occurrence of a function definition with a @linksto
634636
q <- eval_code(qenv(), code)
635637
testthat::expect_identical(
636638
get_code(q, names = "x"),
637-
c(" foo <- function() {\n env <- parent.frame()\n env$x <- 0\n }",
638-
"foo() # @linksto x")
639+
c(
640+
" foo <- function() {\n env <- parent.frame()\n env$x <- 0\n }",
641+
"foo() # @linksto x"
642+
)
639643
)
640644
})
641645
# $ ---------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)