lintr
lintr copied to clipboard
call. argument should not be added for custom conditions
lintr::condition_call_linter() will recommend the addition of call. even for custom conditions crafted with errorCondition() / warningCondition() when these don't support call.=.
stop(errorCondition("stop right there!", class = "custom_error_condition"))
#> Error: stop right there!
lintr::lint(
text = "stop(errorCondition('stop right there!', class = 'custom_error_condition'))",
linters = lintr::condition_call_linter()
)
#> <text>:1:1: warning: [condition_call_linter] Use stop(., call. = FALSE) not to display the call in an error message.
#> stop(errorCondition('stop right there!', class = 'custom_error_condition'))
#> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stop(errorCondition("stop right there!", class = "custom_error_condition"), call. = FALSE)
#> Warning in stop(errorCondition("stop right there!", class =
#> "custom_error_condition"), : additional arguments ignored in stop()
#> Error: stop right there!
Created on 2024-08-08 with reprex v2.1.1