MichaelChirico / r-bugs

A ⚠️read-only⚠️mirror of https://bugs.r-project.org/
20 stars 0 forks source link

[BUGZILLA #17587] Check for ::: misses some usage, gives bad report for some other #6761

Open MichaelChirico opened 4 years ago

MichaelChirico commented 4 years ago

This describes two problems, but the same change would fix both.

  1. The check in "R CMD check" for use of things like package:::fn appears to work by examining the bodies of functions in the package for calls like that. However, this doesn't detect cases like those reported in https://stackoverflow.com/q/57191965/2554330, where code like

load_config = blogdown:::load_config

is at top level in the package R source. A fix for this would be to parse the R files and examine those expressions for bad use of :::.

  1. The other problem confused the poster. If a function is imported using that method, and that function makes use of :::, then it is reported as an error in the package being checked. In that case the import was

split_yaml_body = blogdown:::split_yaml_body

and was reported as

"Unexported object imported by a ':::' call: ‘knitr:::is_blank’"

because blogdown:::split_yaml_body makes that call, which is legal: both knitr and blogdown have the same maintainer. The same issue would happen if blogdown had exported split_yaml_body and the import was done via

split_yaml_body = blogdown::split_yaml_body

(which I checked by modifying the sources to both packages). This one is harder to fix, though I suppose if the first suggested change is made, it won't be an issue, because the check will never look at the body of split_yaml_body.


METADATA

MichaelChirico commented 4 years ago

Using the --no-install option to R CMD check does the parsing the way I suggested, and it does fix both issues.


METADATA