# will produce lints
lint(
text = "f <- function() { 1 }",
linters = brace_linter()
)
writeLines("if (TRUE) {\n return(1) }")
lint(
text = "if (TRUE) {\n return(1) }",
linters = brace_linter()
)
# okay
writeLines("f <- function() {\n 1\n}")
lint(
text = "f <- function() {\n 1\n}",
linters = brace_linter()
)
writeLines("if (TRUE) { \n return(1) \n}")
lint(
text = "if (TRUE) { \n return(1) \n}",
linters = brace_linter()
)
# customizing using arguments
writeLines("if (TRUE) { return(1) }")
lint(
text = "if (TRUE) { return(1) }",
linters = brace_linter(allow_single_line = TRUE)
)
Run the code above in your browser using DataLab