pipe_continuation_linter {lintr} | R Documentation |
Pipe continuation linter
Description
Check that each step in a pipeline is on a new line, or the entire pipe fits on one line.
Usage
pipe_continuation_linter()
Tags
See Also
-
linters for a complete list of linters available in lintr.
Examples
# will produce lints
code_lines <- "1:3 %>%\n mean() %>% as.character()"
writeLines(code_lines)
lint(
text = code_lines,
linters = pipe_continuation_linter()
)
code_lines <- "1:3 |> mean() |>\n as.character()"
writeLines(code_lines)
lint(
text = code_lines,
linters = pipe_continuation_linter()
)
# okay
lint(
text = "1:3 %>% mean() %>% as.character()",
linters = pipe_continuation_linter()
)
code_lines <- "1:3 %>%\n mean() %>%\n as.character()"
writeLines(code_lines)
lint(
text = code_lines,
linters = pipe_continuation_linter()
)
lint(
text = "1:3 |> mean() |> as.character()",
linters = pipe_continuation_linter()
)
code_lines <- "1:3 |>\n mean() |>\n as.character()"
writeLines(code_lines)
lint(
text = code_lines,
linters = pipe_continuation_linter()
)
[Package lintr version 3.1.2 Index]