Skip to content
Prev 35291 / 63424 Next

R CMD check may not detect a code/documentation mismatch

Petr Savicky wrote:
Hmm, looks more like a thinko in this code inside codoc():

     functions_in_code <- Filter(function(f) {
         f <- get(f, envir = code_env)
         is.function(f) && (length(formals(f)) > 0L)
     }, objects_in_code)

which, further down the line, causes functions with no formal arguments 
to be skipped when compared to the usage section.

Browse[2]>
debug: ind <- (!functions %in% functions_to_be_ignored & functions %in%
     functions_in_code)
Browse[2]> functions
[1] "testCoreClass"    "testCoreAttrEval" "testCoreReg" 
"testCoreNA"
Browse[2]>
debug: bad_functions <- mapply(functions[ind], exprs[ind], FUN = 
function(x,
     y) check_codoc(x, as.pairlist(as.alist.call(y[-1L]))), SIMPLIFY = 
FALSE)
Browse[2]> ind
[1]  TRUE  TRUE  TRUE FALSE

I.e. testCoreNA is never tested by check_codoc. There may of course be a 
rationale for this, but it escapes me...