You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
Is more common than calling both together. E.g. here's 139,000 matches of stop() to a non-literal string, but only about 100 where it's stop(errorCondition(.
I would probably only exclude stop(errorCondition( (and the likes).
But I'm happy to align to the usual policy. Are we more leaning towards: "potentially get a lot more more missed lints" OR "potentially get some incorrect lints"?
Of the 139k matches, I suspect most of them should probably still include call.. But indeed, since we cannot statically determine it when a non-string literal is actually a string or not, some of them might also be linting incorrectly.
Another option could be to add an argument to let the user decide but it stills leaves the question of what the default should be.
lintr::condition_call_linter()
will recommend the addition ofcall.
even for custom conditions crafted witherrorCondition()
/warningCondition()
when these don't supportcall.=
.Created on 2024-08-08 with reprex v2.1.1
The text was updated successfully, but these errors were encountered: