Skip to content

Commit 9164083

Browse files
rename to default_style_guide_attributes
1 parent a7b47ff commit 9164083

11 files changed

+21
-21
lines changed

API

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
## Exported functions
44

5-
create_style_guide(initialize = initialize_default_attributes, line_break = NULL, space = NULL, token = NULL, indention = NULL, use_raw_indention = FALSE, reindention = tidyverse_reindention())
6-
initialize_default_attributes(pd_flat)
5+
create_style_guide(initialize = default_style_guide_attributes, line_break = NULL, space = NULL, token = NULL, indention = NULL, use_raw_indention = FALSE, reindention = tidyverse_reindention())
6+
default_style_guide_attributes(pd_flat)
77
specify_math_token_spacing(zero = NULL, one = c("'+'", "'-'", "'*'", "'/'", "'^'"))
88
specify_reindention(regex_pattern = NULL, indention = 0, comments_only = TRUE)
99
style_dir(path = ".", ..., style = tidyverse_style, transformers = style(...), filetype = "R", recursive = TRUE, exclude_files = NULL)

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
S3method(print,vertical)
44
export(create_style_guide)
5-
export(initialize_default_attributes)
5+
export(default_style_guide_attributes)
66
export(specify_math_token_spacing)
77
export(specify_reindention)
88
export(style_dir)

R/indent.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#' Update indention information of parse data
22
#'
33
#' @param pd A nested or flat parse table that is already enhanced with
4-
#' line break and space information via [initialize_default_attributes()].
4+
#' line break and space information via [default_style_guide_attributes()].
55
#' @param indent_by How many spaces should be added after the token of interest.
66
#' @param token The token the indention should be based on.
77
#' @name update_indention

R/initialize.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#' @examples
88
#' string_to_format <- "call( 3)"
99
#' pd <- styler:::compute_parse_data_nested(string_to_format)
10-
#' styler:::pre_visit(pd, c(initialize_default_attributes))
10+
#' styler:::pre_visit(pd, c(default_style_guide_attributes))
1111
#' @export
12-
initialize_default_attributes <- function(pd_flat) {
12+
default_style_guide_attributes <- function(pd_flat) {
1313

1414
init_pd <-
1515
initialize_newlines(pd_flat) %>%

R/nested_to_tree.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#' @importFrom purrr when
88
create_tree <- function(text, structure_only = FALSE) {
99
compute_parse_data_nested(text) %>%
10-
pre_visit(c(initialize_default_attributes)) %>%
10+
pre_visit(c(default_style_guide_attributes)) %>%
1111
create_node_from_nested_root(structure_only) %>%
1212
as.data.frame()
1313
}
@@ -25,7 +25,7 @@ create_tree <- function(text, structure_only = FALSE) {
2525
#' if (getRversion() >= 3.2) {
2626
#' code <- "a <- function(x) { if(x > 1) { 1+1 } else {x} }"
2727
#' nested_pd <- styler:::compute_parse_data_nested(code)
28-
#' initialized <- styler:::pre_visit(nested_pd, c(initialize_default_attributes))
28+
#' initialized <- styler:::pre_visit(nested_pd, c(default_style_guide_attributes))
2929
#' styler:::create_node_from_nested_root(initialized, structure_only = FALSE)
3030
#' }
3131
create_node_from_nested_root <- function(pd_nested, structure_only) {

R/serialized_tests.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ NULL
144144
style_empty <- function(text) {
145145
transformers <- list(
146146
# transformer functions
147-
initialize = initialize_default_attributes,
147+
initialize = default_style_guide_attributes,
148148
line_break = NULL,
149149
space = NULL,
150150
token = NULL,
@@ -163,7 +163,7 @@ style_op <- function(text) {
163163

164164
transformers <- list(
165165
# transformer functions
166-
initialize = initialize_default_attributes,
166+
initialize = default_style_guide_attributes,
167167
line_break = NULL,
168168
space = partial(indent_op, indent_by = 2),
169169
token = NULL,

R/style_guides.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ tidyverse_style <- function(scope = "tokens",
136136

137137
create_style_guide(
138138
# transformer functions
139-
initialize = initialize_default_attributes,
139+
initialize = default_style_guide_attributes,
140140
line_break = line_break_manipulators,
141141
space = space_manipulators,
142142
token = token_manipulators,
@@ -177,7 +177,7 @@ tidyverse_style <- function(scope = "tokens",
177177
#' }
178178
#' style_text("a <- function(x) { x }", style = set_line_break_before_curly_opening_style)
179179
#' @export
180-
create_style_guide <- function(initialize = initialize_default_attributes,
180+
create_style_guide <- function(initialize = default_style_guide_attributes,
181181
line_break = NULL,
182182
space = NULL,
183183
token = NULL,

man/create_style_guide.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/initialize_default_attributes.Rd renamed to man/default_style_guide_attributes.Rd

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/customizing_styler.Rmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ table"):
7373
```{r}
7474
string_to_format <- "call( 3)"
7575
pd <- styler:::compute_parse_data_nested(string_to_format) %>%
76-
styler:::pre_visit(c(initialize_default_attributes))
76+
styler:::pre_visit(c(default_style_guide_attributes))
7777
pd$child[[1]] %>%
7878
select(token, terminal, text, newlines, spaces)
7979
```
8080

81-
`initialize_default_attributes()` is called to initialize some variables, it does not actually
81+
`default_style_guide_attributes()` is called to initialize some variables, it does not actually
8282
transform the parse table.
8383

8484
All the function `remove_space_after_opening_paren()` now does is to look for
@@ -155,7 +155,7 @@ respectively, so we need both.
155155
The sequence in which styler applies rules on each level of nesting is given in
156156
the list below:
157157

158-
* call `initialize_default_attributes()` to initialize some variables.
158+
* call `default_style_guide_attributes()` to initialize some variables.
159159
* modify the line breaks (modifying `lag_newlines` only based on
160160
`token`, `token_before`, `token_after` and `text`).
161161
* modify the spaces (modifying `spaces` only based on `lag_newlines`,

0 commit comments

Comments
 (0)