undesirable_operator_linter {lintr} | R Documentation |
Undesirable operator linter
Description
Report the use of undesirable operators, e.g. :::
or
<<-
and suggest an alternative.
Usage
undesirable_operator_linter(op = default_undesirable_operators)
Arguments
op |
Named character vector. |
Tags
best_practices, configurable, efficiency, robustness, style
See Also
linters for a complete list of linters available in lintr.
Examples
# defaults for which functions are considered undesirable
names(default_undesirable_operators)
# will produce lints
lint(
text = "a <<- log(10)",
linters = undesirable_operator_linter()
)
lint(
text = "mtcars$wt",
linters = undesirable_operator_linter(op = c("$" = "As an alternative, use the `[[` accessor."))
)
# okay
lint(
text = "a <- log(10)",
linters = undesirable_operator_linter()
)
lint(
text = 'mtcars[["wt"]]',
linters = undesirable_operator_linter(op = c("$" = NA))
)
lint(
text = 'mtcars[["wt"]]',
linters = undesirable_operator_linter(op = c("$" = "As an alternative, use the `[[` accessor."))
)
[Package lintr version 3.1.2 Index]