Skip to content

Broken support for #' @importFrom with backticks not documented #1570

Closed

Description

@krlmlr

roxygen2 7.3.0 fails for several of my packages. The only vaguely related NEWS entry I found is

Is the new behavior intended, is it worth waiting for a fix?

roxygen2 7.3.0

library(roxygen2)

roc_proc_text(namespace_roclet(), "
  #' @importFrom purrr `%>%`
  NULL
  ")
#> ✖ <text>:2: @importFrom Excluding unknown export in from purrr: `` `%>%` ``.
#> [1] "importFrom(purrr,)"

roc_proc_text(namespace_roclet(), "
  #' @importFrom purrr %>%
  NULL
  ")
#> [1] "importFrom(purrr,\"%>%\")"

Created on 2024-01-14 with reprex v2.0.2

roxygen2 7.2.3

library(roxygen2)

roc_proc_text(namespace_roclet(), "
  #' @importFrom purrr `%>%`
  NULL
  ")
#> [1] "importFrom(purrr,`%>%`)"

roc_proc_text(namespace_roclet(), "
  #' @importFrom purrr %>%
  NULL
  ")
#> [1] "importFrom(purrr,\"%>%\")"

Created on 2024-01-14 with reprex v2.0.2

Activity

  1. changed the title [-]Broken support for ``#' @importFrom purrr `%>%` `` not documented[/-] [+]Broken support for ```#' @importFrom purrr `%>%` ``` not documented[/+] on Jan 14, 2024
  2. changed the title [-]Broken support for ```#' @importFrom purrr `%>%` ``` not documented[/-] [+]Broken support for `#' @importFrom` with backticks not documented[/+] on Jan 14, 2024
  3. MichaelChirico commented on Jan 15, 2024

    @MichaelChirico
    Contributor

    I confirm from git bisect 38166f0 is the culprit

  4. dchiu911 commented on Jan 16, 2024

    @dchiu911

    I am also getting similar errors when replacing backticks with quotations

    #' @importFrom magrittr "%>%"
    #' @importFrom purrr "%||%"
    
    @importFrom Excluding unknown export in from magrittr: `"%>%"`.
    @importFrom Excluding unknown export in from purrr: `"%||%"`.
    
  5. jdblischak commented on Jan 16, 2024

    @jdblischak

    Try #' @importFrom magrittr %>%. This should work with roxygen2 7.2.3 and 7.3.0

  6. klmr commented on Jan 16, 2024

    @klmr
    Contributor

    I think this is also responsible for the ‘box’ build failures: https://github.com/klmr/box/actions/runs/7535202942

    (Edit: actually on second look this looks unrelated, but it’s also new in ‘roxygen2’ 7.3.0; I’ll investigate further.)

  7. MichaelChirico commented on Jan 17, 2024

    @MichaelChirico
    Contributor

    @klmr I believe yours is related to this NEWS bullet:

    roxygen2/NEWS.md

    Lines 16 to 20 in 767ec1b

    * The NAMESPACE roclet now reports if you have S3 methods that are missing
    an `@export` tag. All S3 methods need to be `@export`ed (which confusingly
    really registers the method) even if the generic is not. This avoids rare,
    but hard to debug, problems (#1175). You can suppress the warning with
    `@exportS3Method NULL` (#1550).

  8. added
    bugan unexpected problem or unintended behavior
    on Jan 17, 2024
  9. added this to the v7.3.1 milestone on Jan 17, 2024
  10. klmr commented on Jan 17, 2024

    @klmr
    Contributor

    @MichaelChirico Thanks, but the warning isn’t the issue I am concerned about, although it is a bit confusing, and in my case incorrect (you do not need to declare methods in NAMESPACE, even in R >3.6, for an internally defined generic as long as it is only used internally). Unfortunately I also can’t silence the warning in a backwards-compatible way: adding #' @exportS3Method NULL causes a different warning on previous versions of ‘roxygen2’. :-(

    I am talking about the bug described in #1575.

  11. added a commit that references this issue on Jan 19, 2024
    a3e3908
  12. hadley commented on Jan 22, 2024

    @hadley
    Member

    And now on CRAN 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions