stopifnot_all_linter {lintr} | R Documentation |
Block usage of all() within stopifnot()
Description
stopifnot(A)
actually checks all(A)
"under the hood" if A
is a vector,
and produces a better error message than stopifnot(all(A))
does.
Usage
stopifnot_all_linter()
Tags
See Also
linters for a complete list of linters available in lintr.
Examples
# will produce lints
lint(
text = "stopifnot(all(x > 0))",
linters = stopifnot_all_linter()
)
lint(
text = "stopifnot(y > 3, all(x < 0))",
linters = stopifnot_all_linter()
)
# okay
lint(
text = "stopifnot(is.null(x) || all(x > 0))",
linters = stopifnot_all_linter()
)
lint(
text = "assert_that(all(x > 0))",
linters = stopifnot_all_linter()
)
[Package lintr version 3.2.0 Index]