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

broken @docType package documentation #1491

Closed
bastistician opened this issue Jun 29, 2023 · 11 comments · Fixed by weecology/ratdat#11, BayerSe/esback#9 or #1535
Closed

broken @docType package documentation #1491

bastistician opened this issue Jun 29, 2023 · 11 comments · Fixed by weecology/ratdat#11, BayerSe/esback#9 or #1535
Labels
bug an unexpected problem or unintended behavior rd ✍️
Milestone

Comments

@bastistician
Copy link
Contributor

bastistician commented Jun 29, 2023

roxygen2 7.0.0 (2019-11-12) had the breaking change

  • Using @docType package no longer automatically adds a -package alias.
    Instead document _PACKAGE to get all the defaults for package documentation

from 29db38f.

However, thousands of packages still use the old way (that was still recommended a year ago)

#' @docType package
#' @name pkgname
NULL

not being aware that they should

because they no longer automatically get that alias that is required for a package overview page to be found via package?pkgname. As a consequence, CRAN now has thousands of packages where this help request no longer works.

Could roxygen2 warn users when there is a @docType package block without corresponding @aliases (and possibly recommend the new _PACKAGE feature)?

@bastistician
Copy link
Contributor Author

bastistician commented Jul 24, 2023

Addendum: I noticed that some packages do use the "_PACKAGE" syntax introduced long ago via @krlmlr's #392, but explicitly remove the default aliases via @aliases NULL (e.g., krlmlr/enc@3ee7849) producing a help page without alias, unaccessible from dynamic help().

I think it would be very useful if roxygen2 actively warned its users about the breaking change from 7.0.0, i.e., when the old approach @docType package on NULL is used (without manually specifying @aliases pkgname-package) and recommend documenting "_PACKAGE". Maybe @krlmlr would have an idea?

@MichaelChirico
Copy link
Contributor

Just came to post the same -- the current warning is misleading, routing users to the more awkward #' @name pkgname-package approach:

[pkgname-package.R:10] Block must have a @name
ℹ Either document an existing object or manually specify with @name

The "_PACKAGE" sentinel approach strikes me as a bit redundant (we've already written #' @docType package), but if this is the requirement we should be steering users there more helpfully.

jonesor added a commit to jonesor/mpmsim that referenced this issue Aug 19, 2023
yihui added a commit to rstudio/markdown that referenced this issue Aug 19, 2023
olbapjose added a commit to olbapjose/FuzzyLP that referenced this issue Aug 19, 2023
Arreglando sugerencia de CRAN: 

You have file 'FuzzyLP/man/FuzzyLP.Rd' with \docType{package}, likely
intended as a package overview help file, but without the appropriate
PKGNAME-package \alias as per "Documenting packages" in R-exts.

This seems to be the consequence of the breaking change

  Using @doctype package no longer automatically adds a -package alias.
  Instead document _PACKAGE to get all the defaults for package
  documentation.

in roxygen2 7.0.0 (2019-11-12) having gone unnoticed, see
<r-lib/roxygen2#1491>.

As explained in the issue, to get the desired PKGNAME-package \alias
back, you should either change to the new approach and document the new
special sentinel

  "_PACKAGE"

or manually add

  @Aliases FuzzyLP-package   --> **esto es lo que hemos hecho**

if remaining with the old approach.
daattali added a commit to daattali/ddpcr that referenced this issue Aug 19, 2023
daattali added a commit to daattali/shinyjs that referenced this issue Aug 19, 2023
daattali added a commit to daattali/timevis that referenced this issue Aug 19, 2023
daattali added a commit to daattali/colourpicker that referenced this issue Aug 19, 2023
daattali added a commit to daattali/shinyalert that referenced this issue Aug 20, 2023
daattali added a commit to daattali/addinslist that referenced this issue Aug 20, 2023
daattali added a commit to daattali/shinycssloaders that referenced this issue Aug 20, 2023
daattali added a commit to daattali/shinybrowser that referenced this issue Aug 20, 2023
daattali added a commit to daattali/shinydisconnect that referenced this issue Aug 20, 2023
daattali added a commit to daattali/shinyscreenshot that referenced this issue Aug 20, 2023
aldomann added a commit to biodosetools-team/biodosetools that referenced this issue Jan 9, 2024
hrlai added a commit to hrlai/novelforestSG that referenced this issue Jan 14, 2024
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jan 25, 2024
## v1.0.6
  * Fix new `-Wformat` warnings.

## v1.0.5
  * Address roxygen2 breaking changes:

  * Add explicit alias for `fansi-package` now that it is no longer
    auto-generated by roxgen2 from the [`@docType package`
    directive](r-lib/roxygen2#1491).
  * Work around [changed behavior for
    `@inheritParams`](r-lib/roxygen2#1515).
richardkwo added a commit to richardkwo/eff2 that referenced this issue Jan 26, 2024
richardkwo added a commit to richardkwo/eff2 that referenced this issue Jan 26, 2024
slager added a commit to ropensci/rvertnet that referenced this issue Feb 8, 2024
ruthkr added a commit to ruthkr/greatR that referenced this issue Feb 26, 2024
Robinlovelace added a commit to ropensci/stplanr that referenced this issue May 1, 2024
dbaston added a commit to dbaston/exactextract that referenced this issue May 16, 2024
@zachmayer
Copy link

This is a really, really dumb question, but how do I make a _PACKAGE document? Is this just like a new file I add to package folder? Is a _PACKAGE something else?

@MichaelChirico
Copy link
Contributor

@zachmayer maybe a useful reference example

https://github.com/tidyverse/tibble/blob/main/R/tibble-package.R

@zachmayer
Copy link

lol I was overthinking it. As always a reference was all I needed. Thank you!

https://github.com/tidyverse/tibble/blob/main/R/tibble-package.R#L62

@bbolker
Copy link

bbolker commented Jul 31, 2024

tl;dr can anyone explain why I'm getting a spurious \alias{-package} in my .Rd file?

Confused on this issue, don't know if anyone can help me out. I'm maintaining a legacy package. The roxygen stuff at the head of the package-defining .R file looks like this:

#' @rdname margins
#' @name margins
#' @aliases margins-package
#' @docType package
#' @title Marginal Effects Estimation

But the head of margins.R looks like this:

\docType{package}
\name{margins}
\alias{-package}
\alias{margins}
\alias{margins-package}

This is with roxygen2 7.3.2. I could rearrange everything to follow the now-recommended _PACKAGES approach, but if I can minimally fix what I'm doing wrong I would prefer it. (Of course I could also manually edit the .Rd file to get rid of the spurious alias, which is what I'll do for now ...)

Here's the repo if anyone wants to look at the original.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior rd ✍️
Projects
None yet
5 participants