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 support for #' @importFrom with backticks not documented #1570

Closed
krlmlr opened this issue Jan 14, 2024 · 7 comments · Fixed by #1574
Closed

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

krlmlr opened this issue Jan 14, 2024 · 7 comments · Fixed by #1574
Labels
bug an unexpected problem or unintended behavior
Milestone

Comments

@krlmlr
Copy link
Member

krlmlr commented Jan 14, 2024

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

@krlmlr krlmlr changed the title Broken support for `#' @importFrom purrr %>% ` not documented Broken support for ``#' @importFrom purrr %>% `` not documented Jan 14, 2024
@krlmlr krlmlr changed the title Broken support for ``#' @importFrom purrr %>% `` not documented Broken support for #' @importFrom with backticks not documented Jan 14, 2024
krlmlr added a commit to cynkra/fledge that referenced this issue Jan 14, 2024
@MichaelChirico
Copy link
Contributor

I confirm from git bisect 38166f0 is the culprit

@dchiu911
Copy link

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: `"%||%"`.

@jdblischak
Copy link

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

@klmr
Copy link
Contributor

klmr commented Jan 16, 2024

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.)

@MichaelChirico
Copy link
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).

@hadley hadley added the bug an unexpected problem or unintended behavior label Jan 17, 2024
@hadley hadley added this to the v7.3.1 milestone Jan 17, 2024
@klmr
Copy link
Contributor

klmr commented Jan 17, 2024

@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.

@hadley
Copy link
Member

hadley commented Jan 22, 2024

And now on CRAN 😄

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants