View source: R/condition_message_linter.R
condition_message_linter | R Documentation |
paste()
and paste0()
with messaging functions using ...
This linter discourages combining condition functions like stop()
with string concatenation
functions paste()
and paste0()
. This is because
stop(paste0(...))
is redundant as it is exactly equivalent to stop(...)
stop(paste(...))
is similarly equivalent to stop(...)
with separators (see examples)
The same applies to the other default condition functions as well, i.e., warning()
, message()
,
and packageStartupMessage()
.
condition_message_linter()
best_practices, consistency
linters for a complete list of linters available in lintr.
# will produce lints
lint(
text = 'stop(paste("a string", "another"))',
linters = condition_message_linter()
)
lint(
text = 'warning(paste0("a string", " another"))',
linters = condition_message_linter()
)
# okay
lint(
text = 'stop("a string", " another")',
linters = condition_message_linter()
)
lint(
text = 'warning("a string", " another")',
linters = condition_message_linter()
)
lint(
text = 'warning(paste("a string", "another", sep = "-"))',
linters = condition_message_linter()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.