[Roxygen-devel] skip functions with no roxygen comments

Felix Andrews felix at nfrac.org
Tue Feb 2 07:18:52 CET 2010


Hi,

I've just started using roxygen, it's a great system, thanks.

I have been looking into the problem of too many .Rd files being
generated -- i.e. that .Rd files are generated for *all* functions in
the source code. I would like internal functions, and those aliased to
other functions, to be ignored.

I propose that any function which does not have preceding roxygen
comments should be ignored by roxygen. Perhaps in the future it could
be possible to generate the @usage for aliased functions, in which
case they should not be ignored completely, but even in that case I
think they should have preceding roxygen comments, like "@export".

If that is acceptable, I think the change could be made in
parse.srcfile(), in parse.R, line 449:

OLD:
parse.srcfile <- function(srcfile) {
  srcrefs <- attributes(parse(srcfile$filename,
                              srcfile=srcfile))$srcref
  if (length(srcrefs) > 0)
    parse.refs(zip.list(prerefs(srcfile, srcrefs), srcrefs))
  else
    nil
}

NEW:
parse.srcfile <- function(srcfile) {
  srcrefs <- attributes(parse(srcfile$filename,
                              srcfile=srcfile))$srcref
  if (length(srcrefs) > 0) {
    pairs <- zip.list(prerefs(srcfile, srcrefs), srcrefs)
    empty <- sapply(pairs, function(x) is.nil(car(x)))
    parse.refs(pairs[!empty])
  } else
    nil
}


Note that I have not tested this.


-- 
Felix Andrews / 安福立
Postdoctoral Fellow
Integrated Catchment Assessment and Management (iCAM) Centre
Fenner School of Environment and Society [Bldg 48a]
The Australian National University
Canberra ACT 0200 Australia
M: +61 410 400 963
T: + 61 2 6125 4670
E: felix.andrews at anu.edu.au
CRICOS Provider No. 00120C
-- 
http://www.neurofractal.org/felix/


More information about the Roxygen-devel mailing list