library_call_linter {lintr} | R Documentation |
Library call linter
Description
Force library calls to all be at the top of the script.
Usage
library_call_linter(allow_preamble = TRUE)
Arguments
allow_preamble |
Logical, default |
Tags
best_practices, configurable, readability, style
See Also
linters for a complete list of linters available in lintr.
Examples
# will produce lints
lint(
text = "
library(dplyr)
print('test')
library(tidyr)
",
linters = library_call_linter()
)
lint(
text = "
library(dplyr)
print('test')
library(tidyr)
library(purrr)
",
linters = library_call_linter()
)
# okay
lint(
text = "
library(dplyr)
print('test')
",
linters = library_call_linter()
)
lint(
text = "
# comment
library(dplyr)
",
linters = library_call_linter()
)
[Package lintr version 3.1.2 Index]