Skip to content

Commit b5e09d0

Browse files
Iron out styling inconsistencies (#2194)
1 parent 1183f15 commit b5e09d0

10 files changed

+13
-16
lines changed

R/indentation_linter.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ indentation_linter <- function(indent = 2L, hanging_indent_style = c("tidy", "al
225225

226226
indent_levels <- re_matches(
227227
source_expression$file_lines,
228-
rex(start, any_spaces), locations = TRUE
228+
rex(start, any_spaces),
229+
locations = TRUE
229230
)[, "end"]
230231
expected_indent_levels <- integer(length(indent_levels))
231232
is_hanging <- logical(length(indent_levels))
@@ -351,8 +352,7 @@ build_indentation_style_tidy <- function() {
351352
@line1 = following-sibling::{paren_tokens_right}/{xp_inner_expr}[position() = 1]/@line1
352353
]/following-sibling::{paren_tokens_right}[
353354
@line1 > {xp_inner_expr}[position() = last() - 1]/@line2
354-
]"
355-
),
355+
]"),
356356
collapse = " | "
357357
)
358358

R/keyword_quote_linter.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#' )
4040
#'
4141
#' lint(
42-
#' text = 'my_list$`a b`',
42+
#' text = "my_list$`a b`",
4343
#' linters = keyword_quote_linter()
4444
#' )
4545
#'

R/matrix_apply_linter.R

+1-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#' @seealso [linters] for a complete list of linters available in lintr.
3131
#' @export
3232
matrix_apply_linter <- function() {
33-
3433
# mean() and sum() have very different signatures so we treat them separately.
3534
# sum() takes values to sum over via ..., has just one extra argument and is not a generic
3635
# mean() is a generic, takes values to average via a single argument, and can have extra arguments
@@ -73,7 +72,7 @@ matrix_apply_linter <- function() {
7372

7473
# This doesn't handle the case when MARGIN and FUN are named and in a different position
7574
# but this should be relatively rate
76-
var_xpath <- "expr[position() = 2]"
75+
var_xpath <- "expr[position() = 2]"
7776
margin_xpath <- "expr[position() = 3]"
7877
fun_xpath <- "expr[position() = 4]"
7978

@@ -108,7 +107,6 @@ matrix_apply_linter <- function() {
108107
}
109108

110109
craft_colsums_rowsums_msg <- function(var, margin, fun, narm_val) {
111-
112110
if (is.na(xml_find_first(margin, "OP-COLON"))) {
113111
l1 <- xml_text(margin)
114112
l2 <- NULL

R/pipe_consistency_linter.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#' )
2727
#'
2828
#' lint(
29-
#' text = "1:3 |> mean() |> as.character()",
30-
#' linters = pipe_consistency_linter()
29+
#' text = "1:3 |> mean() |> as.character()",
30+
#' linters = pipe_consistency_linter()
3131
#' )
3232
#' @evalRd rd_tags("pipe_consistency_linter")
3333
#' @seealso [linters] for a complete list of linters available in lintr.

R/repeat_linter.R

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#' linters = repeat_linter()
1717
#' )
1818
#'
19-
#'
2019
#' @evalRd rd_tags("repeat_linter")
2120
#' @seealso [linters] for a complete list of linters available in lintr.
2221
#' @export

R/settings.R

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
#' Read lintr settings
32
#'
43
#' Lintr searches for settings for a given source file in the following order:

R/xp_utils.R

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
# like `text() %in% table`, translated to XPath 1.0
44
xp_text_in_table <- function(table) {
5-
if (length(table) == 0L) return("true")
5+
if (length(table) == 0L) {
6+
return("true")
7+
}
68
# xpath doesn't seem to have a standard way of escaping quotes, so attempt
79
# to use "" whenever the string has ' (not a perfect solution). info on
810
# escaping from https://stackoverflow.com/questions/14822153

man/keyword_quote_linter.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/pipe_consistency_linter.Rd

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/repeat_linter.Rd

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)