Skip to content

Commit 6563c51

Browse files
committed
get rid of regex_none()
- Remove `regex_none()`, document `NULL` default.
1 parent c8ce5de commit 6563c51

File tree

7 files changed

+11
-39
lines changed

7 files changed

+11
-39
lines changed

API

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
## Exported functions
44

55
create_style_guide(initialize = initialize_attributes, line_break = NULL, space = NULL, token = NULL, indention = NULL, use_raw_indention = FALSE, reindention = tidyverse_reindention())
6-
regex_none()
76
specify_math_token_spacing(zero = NULL, one = c("'+'", "'-'", "'*'", "'/'", "'^'"))
8-
specify_reindention(regex_pattern = regex_none(), indention = 0, comments_only = TRUE)
7+
specify_reindention(regex_pattern = NULL, indention = 0, comments_only = TRUE)
98
style_dir(path = ".", ..., style = tidyverse_style, transformers = style(...), filetype = "R", recursive = TRUE, exclude_files = NULL)
109
style_file(path, ..., style = tidyverse_style, transformers = style(...))
1110
style_pkg(pkg = ".", ..., style = tidyverse_style, transformers = style(...), filetype = "R", exclude_files = "R/RcppExports.R")
1211
style_text(text, ..., style = tidyverse_style, transformers = style(...))
1312
tidyverse_math_token_spacing()
1413
tidyverse_reindention()
1514
tidyverse_style(scope = "tokens", strict = TRUE, indent_by = 2, start_comments_with_one_space = FALSE, reindention = tidyverse_reindention(), math_token_spacing = tidyverse_math_token_spacing())
15+
16+
## Foreign S3 methods
17+
18+
print.vertical(x, ...)

NAMESPACE

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

33
S3method(print,vertical)
44
export(create_style_guide)
5-
export(regex_none)
65
export(specify_math_token_spacing)
76
export(specify_reindention)
87
export(style_dir)

R/reindent.R

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,3 @@ set_regex_indention <- function(flattened_pd,
154154
bind_rows(to_check, not_to_check) %>%
155155
arrange(pos_id)
156156
}
157-
158-
#' Return regex patterns for re-indention
159-
#'
160-
#' @name regex_for_reindention
161-
NULL
162-
163-
#' @export
164-
#' @describeIn regex_for_reindention Returns `NULL`, i.e. no pattern will
165-
#' match against this.
166-
regex_none <- function() {
167-
NULL
168-
}

R/style_guides.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ create_style_guide <- function(initialize = initialize_attributes,
194194
#' defaults, so the user can specify deviations from them conveniently without
195195
#' the need of setting all arguments explicitly.
196196
#' @param regex_pattern Character vector with regular expression patterns that
197-
#' are to be re-indented with spaces.
197+
#' are to be re-indented with spaces, `NULL` if no reindention needed.
198198
#' @param indention The indention tokens should have if they match
199199
#' `regex_pattern`.
200200
#' @param comments_only Whether the `regex_reindention_pattern` should only be
@@ -206,7 +206,7 @@ NULL
206206
#' @describeIn reindention Allows to specify which tokens are reindented and
207207
#' how.
208208
#' @export
209-
specify_reindention <- function(regex_pattern = regex_none(),
209+
specify_reindention <- function(regex_pattern = NULL,
210210
indention = 0,
211211
comments_only = TRUE)
212212
lst(
@@ -221,7 +221,7 @@ specify_reindention <- function(regex_pattern = regex_none(),
221221
#' @export
222222
tidyverse_reindention <- function() {
223223
specify_reindention(
224-
regex_pattern = regex_none(), indention = 0, comments_only = TRUE
224+
regex_pattern = NULL, indention = 0, comments_only = TRUE
225225
)
226226
}
227227

man/regex_for_reindention.Rd

Lines changed: 0 additions & 18 deletions
This file was deleted.

man/reindention.Rd

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

tests/testthat/test-unindention_regex.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test_that("do not force regex token-dependent indention without pattern", {
1313
expect_warning(test_collection(
1414
"unindention_regex", "regex_force_no",
1515
transformer = style_text,
16-
reindention = specify_reindention(regex_none())), NA)
16+
reindention = specify_reindention(NULL)), NA)
1717
})
1818

1919

0 commit comments

Comments
 (0)