Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_PACKAGE sentinel default: Alias duplicated when documenting a package that has a function of the same name #1508

Closed
trusch139 opened this issue Aug 20, 2023 · 1 comment

Comments

@trusch139
Copy link

trusch139 commented Aug 20, 2023

Dear roxygen2 developers,

it looks like if a package has the same name as a
function in the package, the default aliasing using the "_PACKAGE"
sentinel will create two aliases of the same name in different .Rd files
and R CMD check --as-cran will complain.

E.g. using roxygen 7.2.3 and using

#'@keywords internal
"_PACKAGE"

in a file foo-package.R AND if there also is a foo.R documented with
roxygen, a file foo-package.Rd with \alias{foo} is created and there will also
be a file foo.Rd with \alias{foo}

The R CMD check --as-cran then says

Rd files with duplicated alias 'foo':
   ‘foo-package.Rd’ ‘foo.Rd’

This can be manually prevented by setting the aliases in foo-package.R to
foo-package only, as

#'@keywords internal
#'@aliases foo-package
"_PACKAGE"

which is why I believe it is due to the default aliases that are created.

@hadley
Copy link
Member

hadley commented Nov 1, 2023

Yeah, that's documented here: https://roxygen2.r-lib.org/articles/rd-other.html#packages

Unfortunately I don't think there's anything we can do to automate the fix, but it seems like you'll now get a warning from CRAN about this problem.

@hadley hadley closed this as completed Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants