Skip to content

Commit 140f84e

Browse files
also negative ones
1 parent 999cede commit 140f84e

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

R/relevel.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ flatten_operators_one <- function(pd_nested) {
5252
#' from left or from right.
5353
#' @keywords internal
5454
flatten_pd <- function(pd_nested, token, child_token = token, left = TRUE) {
55-
token_pos_candidates <- which(pd_nested$token[-1] %in% token) + 1L
55+
token_pos_candidates <- which(pd_nested$token[-1L] %in% token) + 1L
5656
if (length(token_pos_candidates) == 0L) {
5757
return(pd_nested)
5858
}
@@ -70,7 +70,7 @@ flatten_pd <- function(pd_nested, token, child_token = token, left = TRUE) {
7070
if (pos < 1L) {
7171
return(pd_nested)
7272
}
73-
if (!any(pd_nested$child[[pos]]$token[-1] %in% child_token)) {
73+
if (!any(pd_nested$child[[pos]]$token[-1L] %in% child_token)) {
7474
return(pd_nested)
7575
}
7676
bind_with_child(pd_nested, pos)

R/roxygen-examples-add-remove.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ add_roxygen_mask <- function(text, initial_text, example_type) {
4646
space <- ifelse(text == "", "", " ")
4747
out <- c(
4848
paste0("#' @", example_type, space[1L], text[1L]),
49-
map2_chr(space[-1], text[-1], ~ paste0("#'", .x, .y))
49+
map2_chr(space[-1L], text[-1L], ~ paste0("#'", .x, .y))
5050
)
5151

5252
ordinary_comment <- grep("^#[^']", initial_text, value = TRUE)

R/roxygen-examples-parse.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ emulate_rd <- function(roxygen) {
147147
roxygen2::rd_roclet(),
148148
paste(roxygen, collapse = "\n")
149149
)[[1L]]$get_section("examples")
150-
text <- as.character(text)[-1]
150+
text <- as.character(text)[-1L]
151151
text <- c(
152152
if (grepl("^#'(\\s|\t)*@examples(\\s|\t)*$", roxygen[2L])) "",
153153
text

R/rules-indention.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ NULL
106106
#' @keywords internal
107107
update_indention_ref_fun_dec <- function(pd_nested) {
108108
if (pd_nested$token[1L] == "FUNCTION") {
109-
seq <- seq2(3, nrow(pd_nested) - 2)
109+
seq <- seq2(3L, nrow(pd_nested) - 2L)
110110
pd_nested$indention_ref_pos_id[seq] <- pd_nested$pos_id[2L]
111111
}
112112
pd_nested

R/rules-line-breaks.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ style_line_break_around_curly <- function(strict, pd) {
165165
is_else <- pd$token == "ELSE"
166166
if (any(pd$token_before[is_else] == "'}'")) {
167167
pd$lag_newlines[is_else] <- 0L
168-
pd$spaces[c(is_else, FALSE)[-1]] <- 1L
168+
pd$spaces[c(is_else, FALSE)[-1L]] <- 1L
169169
}
170170
is_if_after_else <- pd$token == "ELSE" & pd$token_after == "IF"
171171
pd$lag_newlines[lag(is_if_after_else)] <- 0L
@@ -387,7 +387,7 @@ remove_line_break_in_fun_call <- function(pd, strict) {
387387

388388
set_linebreak_after_ggplot2_plus <- function(pd) {
389389
# if expression is unary, first token is +. Exclude this case.
390-
is_plus_raw <- c(FALSE, pd$token[-1] == "'+'")
390+
is_plus_raw <- c(FALSE, pd$token[-1L] == "'+'")
391391
if (any(is_plus_raw)) {
392392
first_plus <- which(is_plus_raw)[1L]
393393
next_non_comment <- next_non_comment(pd, first_plus)

R/testing.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ generate_test_samples <- function() {
290290
""
291291
} else {
292292
c(
293-
paste0(x[1L], gen(x[-1])),
294-
paste0(x[1L], " # comment\n", paste(x[-1], collapse = ""))
293+
paste0(x[1L], gen(x[-1L])),
294+
paste0(x[1L], " # comment\n", paste(x[-1L], collapse = ""))
295295
)
296296
}
297297
}

R/transform-block.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ parse_transform_serialize_r_block <- function(pd_nested,
4545
)
4646
} else {
4747
serialized_transformed_text <- map2(
48-
c(0, find_blank_lines_to_next_expr(pd_nested)[-1] - 1L),
48+
c(0, find_blank_lines_to_next_expr(pd_nested)[-1L] - 1L),
4949
paste0(rep_char(" ", base_indention), pd_nested$text),
5050
~ c(rep("", .x), .y)
5151
) %>%

0 commit comments

Comments
 (0)