Intermittent warnings

Author

Galen Holt

I’ve been dealing with debugging a package with a dplyr warning that only appears every 8 hours with the message

This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.

It causes warnings every time I test the whole package with devtools::test(), but only every 8 hours otherwise, which makes tracing and debugging impossible.

{rlang} provides a way to set {lifecycle} warning frequencies (docs) so I set in my test script

rlang::local_options(lifecycle_verbosity = "warning")

I think this should do it too

options(lifecycle_verbosity = "warning")

Sometimes those settings aren’t enough - they tend to work with devtools::test, but not for interactively running code and trying to use the debugger to find the issue. In those cases, it seems to work to set the verbosity to ‘error’

rlang::local_options(lifecycle_verbosity = "error")
# or
options(lifecycle_verbosity = "error")