diff --git a/DESCRIPTION b/DESCRIPTION index f4ff31c77..2ee3c61ef 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -7,9 +7,7 @@ Description: Pretty-prints R code without changing the user's formatting intent. Imports: dplyr, - magrittr, purrr, - readr, rlang, rprojroot, tibble, diff --git a/R/nested_to_tree.R b/R/nested_to_tree.R index a2217d37d..cccfbca47 100644 --- a/R/nested_to_tree.R +++ b/R/nested_to_tree.R @@ -17,11 +17,10 @@ create_tree <- function(text) { #' @param pd_nested A nested tibble. #' @return An object of class "Node" and "R6". #' @examples -#' library("magrittr") #' code <- "a <- function(x) { if(x > 1) { 1+1 } else {x} }" -#' l1 <- styler:::compute_parse_data_nested(code) %>% -#' styler:::pre_visit(c(styler:::create_filler)) %>% -#' styler:::create_node_from_nested_root() +#' nested_pd <- styler:::compute_parse_data_nested(code) +#' initialized <- styler:::pre_visit(nested_pd, c(styler:::create_filler)) +#' styler:::create_node_from_nested_root(initialized) create_node_from_nested_root <- function(pd_nested) { n <- data.tree::Node$new("ROOT (token: short_text [lag_newlines/spaces] {id})") create_node_from_nested(pd_nested, n) diff --git a/R/styler.R b/R/styler.R index 41640f581..cb7cc41aa 100644 --- a/R/styler.R +++ b/R/styler.R @@ -4,4 +4,14 @@ #' according to a style guide. See the INDEX for more information. #' "_PACKAGE" -if (getRversion() >= "2.15.1") utils::globalVariables(c(".")) +if (getRversion() >= "2.15.1") { + utils::globalVariables(c( + ".", + "pd", "pd_nested", "pd_flat", "flattened_pd", + "line1", "line2", "col1", "col2", + "terminal", "text", "short", + "spaces", "lag_spaces", + "newlines", "lag_newlines", + NULL + )) +} diff --git a/man/create_node_from_nested_root.Rd b/man/create_node_from_nested_root.Rd index 679983f64..9919dff13 100644 --- a/man/create_node_from_nested_root.Rd +++ b/man/create_node_from_nested_root.Rd @@ -17,9 +17,8 @@ This function is convenient to display all nesting levels of a nested tibble at once. } \examples{ -library("magrittr") code <- "a <- function(x) { if(x > 1) { 1+1 } else {x} }" -l1 <- styler:::compute_parse_data_nested(code) \%>\% - styler:::pre_visit(c(styler:::create_filler)) \%>\% - styler:::create_node_from_nested_root() +nested_pd <- styler:::compute_parse_data_nested(code) +initialized <- styler:::pre_visit(nested_pd, c(styler:::create_filler)) +styler:::create_node_from_nested_root(initialized) } diff --git a/tests/testthat/public-api/xyzpackage/.Rbuildignore b/tests/testthat/public-api/xyzpackage/.Rbuildignore deleted file mode 100644 index 91114bf2f..000000000 --- a/tests/testthat/public-api/xyzpackage/.Rbuildignore +++ /dev/null @@ -1,2 +0,0 @@ -^.*\.Rproj$ -^\.Rproj\.user$ diff --git a/tests/testthat/public-api/xyzpackage/.gitignore b/tests/testthat/public-api/xyzpackage/.gitignore deleted file mode 100644 index 807ea2517..000000000 --- a/tests/testthat/public-api/xyzpackage/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.Rproj.user -.Rhistory -.RData