View source: R/consecutive_assertion_linter.R
consecutive_assertion_linter | R Documentation |
stopifnot()
accepts any number of tests, so sequences like
stopifnot(x); stopifnot(y)
are redundant. Ditto for tests using
assertthat::assert_that()
without specifying msg=
.
consecutive_assertion_linter()
consistency, readability, style
linters for a complete list of linters available in lintr.
# will produce lints
lint(
text = "stopifnot(x); stopifnot(y)",
linters = consecutive_assertion_linter()
)
lint(
text = "assert_that(x); assert_that(y)",
linters = consecutive_assertion_linter()
)
# okay
lint(
text = "stopifnot(x, y)",
linters = consecutive_assertion_linter()
)
lint(
text = 'assert_that(x, msg = "Bad x!"); assert_that(y)',
linters = consecutive_assertion_linter()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.