@@ -4692,7 +4692,7 @@ function(package, dir, lib.loc = NULL)
46924692
46934693 # # and then check the anchored ones if we can.
46944694 have_colon <- grepl(" :" , anchor , fixed = TRUE )
4695- unknown <- character ()
4695+ unknown <- undeclared <- unavailable <- character ()
46964696 thispkg <- anchor
46974697 thisfile <- db [, 1L ]
46984698 thispkg [have_colon ] <- sub(" ([^:]*):(.*)" , " \\ 1" , anchor [have_colon ])
@@ -4725,12 +4725,6 @@ function(package, dir, lib.loc = NULL)
47254725 undeclared <- setdiff(undeclared , enh )
47264726 }
47274727 }
4728- if (length(undeclared ))
4729- message(sprintf(ngettext(length(undeclared ),
4730- " Undeclared package %s in Rd xrefs" ,
4731- " Undeclared packages %s in Rd xrefs" ),
4732- paste(sQuote(undeclared ), collapse = " , " )),
4733- domain = NA )
47344728 }
47354729
47364730 mind_suspects <-
@@ -4799,7 +4793,7 @@ function(package, dir, lib.loc = NULL)
47994793 }
48004794
48014795 unknown <- unique(unknown )
4802- if (length(unknown )) {
4796+ if (length(unknown )) {
48034797 # # respect _R_CHECK_XREFS_REPOSITORIES_ for this use
48044798 repos <- .get_standard_repository_URLs(ForXrefs = TRUE )
48054799 # # Also allow for additionally specified repositories.
@@ -4813,26 +4807,22 @@ function(package, dir, lib.loc = NULL)
48134807 miss <- if (inherits(known , " try-error" )) TRUE
48144808 else unknown %in% c(known , c(" GLMMGibbs" , " survnnet" , " yags" ))
48154809 # # from CRANextras
4816- if (any(miss ))
4817- message(sprintf(ngettext(sum(miss ),
4818- " Package unavailable to check Rd xrefs: %s" ,
4819- " Packages unavailable to check Rd xrefs: %s" ),
4820- paste(sQuote(unknown [miss ]), collapse = " , " )),
4821- domain = NA )
4822- if (any(! miss ))
4823- message(sprintf(ngettext(sum(! miss ),
4824- " Unknown package %s in Rd xrefs" ,
4825- " Unknown packages %s in Rd xrefs" ),
4826- paste(sQuote(unknown [! miss ]), collapse = " , " )),
4827- domain = NA )
4810+ unavailable <- unknown [miss ]
4811+ unknown <- unknown [! miss ]
48284812 }
4813+
48294814 # # The bad ones:
48304815 bad <- db [, " bad" ] == " TRUE"
4816+
48314817 out <- list (bad = split(db [bad , " report" ], db [bad , " File" ]))
48324818 if (mind_suspects && any(ind <- db [, " suspect" ] == " TRUE" )) {
48334819 out <- c(out , list (suspect = split(db [ind , " report" ],
48344820 db [ind , " File" ])))
48354821 }
4822+ out <- c(out , Filter(length ,
4823+ list (unknown = unknown ,
4824+ undeclared = undeclared ,
4825+ unavailable = unavailable )))
48364826 structure(out , class = " check_Rd_xrefs" )
48374827}
48384828
@@ -4841,7 +4831,7 @@ function(x, ...)
48414831{
48424832 xb <- x $ bad
48434833 xs <- x $ suspect
4844- if (length( xb ) || length( xs ) ) {
4834+ if (any(lengths( x )) > 0L ) {
48454835 .fmtb <- function (i ) {
48464836 c(gettextf(" Missing link(s) in Rd file '%s':" ,
48474837 names(xb )[i ]),
@@ -4855,9 +4845,25 @@ function(x, ...)
48554845 .pretty_format(unique(xs [[i ]])),
48564846 " " )
48574847 }
4858- c(unlist(lapply(seq_along(xb ), .fmtb )),
4848+ c(if (length(y <- x $ undeclared ))
4849+ sprintf(ngettext(length(y ),
4850+ " Undeclared package %s in Rd xrefs" ,
4851+ " Undeclared packages %s in Rd xrefs" ),
4852+ paste(sQuote(y ), collapse = " , " )),
4853+ if (length(y <- x $ unavailable ))
4854+ sprintf(ngettext(length(y ),
4855+ " Package unavailable to check Rd xrefs: %s" ,
4856+ " Packages unavailable to check Rd xrefs: %s" ),
4857+ paste(sQuote(y ), collapse = " , " )),
4858+ if (length(y <- x $ unknown ))
4859+ sprintf(ngettext(length(y ),
4860+ " Unknown package %s in Rd xrefs" ,
4861+ " Unknown packages %s in Rd xrefs" ),
4862+ paste(sQuote(y ), collapse = " , " )),
4863+ unlist(lapply(seq_along(xb ), .fmtb )),
48594864 unlist(lapply(seq_along(xs ), .fmts )),
4860- strwrap(gettextf(" See section 'Cross-references' in the 'Writing R Extensions' manual." ))
4865+ if (length(xb ) || length(xs ))
4866+ strwrap(gettextf(" See section 'Cross-references' in the 'Writing R Extensions' manual." ))
48614867 )
48624868 } else {
48634869 character ()
0 commit comments