View source: R/semicolon_linter.R
semicolon_linter | R Documentation |
Check that no semicolons terminate expressions.
semicolon_linter(allow_compound = FALSE, allow_trailing = FALSE)
allow_compound |
Logical, default |
allow_trailing |
Logical, default |
configurable, default, readability, style
linters for a complete list of linters available in lintr.
# will produce lints
lint(
text = "a <- 1;",
linters = semicolon_linter()
)
lint(
text = "a <- 1; b <- 1",
linters = semicolon_linter()
)
lint(
text = "function() { a <- 1; b <- 1 }",
linters = semicolon_linter()
)
# okay
lint(
text = "a <- 1",
linters = semicolon_linter()
)
lint(
text = "a <- 1;",
linters = semicolon_linter(allow_trailing = TRUE)
)
code_lines <- "a <- 1\nb <- 1"
writeLines(code_lines)
lint(
text = code_lines,
linters = semicolon_linter()
)
lint(
text = "a <- 1; b <- 1",
linters = semicolon_linter(allow_compound = TRUE)
)
code_lines <- "function() { \n a <- 1\n b <- 1\n}"
writeLines(code_lines)
lint(
text = code_lines,
linters = semicolon_linter()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.