r-lib/rex

"Note: possible error in 'or(...)'" during R CMD INSTALL

salim-b opened this issue · 1 comments

I use a simple

rex::rex(start, or("1st_string",
                   "2nd_string",
                   "3rd_string",
                   "4th_string"))

in an R package and followed the advice to call rex::register_shortcuts(pkg_name = "my_pkg") to avoid NOTEs by R CMD Check.

But when building the package, R CMD INSTALL prints a note like:

** byte-compile and prepare package for lazy loading
Note: possible error in 'or("1st_string", ': unused arguments ("3rd_string", "4th_string") at (...)

What's happening here?

When I wrap the strings in an additional c(), the note goes away. But rex:::or() takes a dots argument

> rex:::or
function (...) 
{
    group(regex(paste0(collapse = "|", unlist(escape_dots(...)))))
}
<bytecode: 0x56006a276840>
<environment: namespace:rex>

so why the complaint about unused arguments? (they're actually properly used, it's just R CMD INSTALL that complains...)

Looks to me like a false positive from R CMD check, unfortunately there is not much we can do about it other than using your suggested workaround.