Roxygen2: Invalid `@export` should include more details in error

Created on 11 Apr 2020  Â·  8Comments  Â·  Source: r-lib/roxygen2

Opening a new issue following up on an unresolved closed one as advised in #415 .

This problem still persists: https://github.com/r-lib/roxygen2/issues/415#issuecomment-421744184

For example, running roxygen2 documentation for:

#' @export
#' @rdname colors
foo <- function(egg){NULL}

works, but fails for

#' @rdname colors
#' @export
foo <- function(egg){NULL}

With warning @export may only span a single line

#> R version 3.6.3 (2020-02-29)
#> Platform: x86_64-apple-darwin15.6.0 (64-bit)
#> Running under: macOS Catalina 10.15
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
#> 
#> locale:
#> [1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] roxygen2_7.1.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.3      digest_0.6.25   R6_2.4.1        magrittr_1.5   
#>  [5] evaluate_0.14   highr_0.8       rlang_0.4.5     stringi_1.4.6  
#>  [9] xml2_1.2.5      rmarkdown_2.1   tools_3.6.3     stringr_1.4.0  
#> [13] purrr_0.3.3     xfun_0.12       yaml_2.2.1      compiler_3.6.3 
#> [17] htmltools_0.4.0 knitr_1.28

Created on 2020-04-11 by the reprex package (v0.3.0)

feature rd

Most helpful comment

@nacnudus roxygen simply concatenates the comment lines, so that is the same as

#' @export
#' First comment
#' Second comment
fun <- function() {
}

and then the message is expected.

And yes, this was the original problem, probably. Maybe we could have a better error message.

All 8 comments

If further specificity is required, I can think of no better reproducible example than to clone our package, checkout to this commit, and observe the oxygen documentation behaviour when swapping lines https://github.com/mixOmicsTeam/mixOmics/blob/roxygenated/R/colors.R#L88 and https://github.com/mixOmicsTeam/mixOmics/blob/roxygenated/R/colors.R#L89

Thanks in advance

Please see https://github.com/r-lib/roxygen2/blob/master/.github/SUPPORT.md#making-a-reprex on creating reproducible examples. Thanks!

As mentioned in the previous thread, unfortunately, the behaviour itself is inconsistent, so not sure if this issue needs to be closed or remain open for those who might be able to reproduce it.

It's very unlikely to be that same problem given that 5 years have elapsed, and if such a serious problem existed many people would have reported it. And unfortunately given that it's not reproducible, there's not much we can do to fix it — it's likely to be something peculiar to your system.

FWIW I have seen this, too, not so long ago, but cannot repro it now. If it comes up again, I'll open this issue.

I can reproduce this in a clean package with only the following function.

#' @export
fun <- function() {
  #' First comment
  #' Second comment
}

@nacnudus roxygen simply concatenates the comment lines, so that is the same as

#' @export
#' First comment
#' Second comment
fun <- function() {
}

and then the message is expected.

And yes, this was the original problem, probably. Maybe we could have a better error message.

Just got bit by this! Agree it's hard to debug. One possibility could be to include the beginning of the culprit text -- if I had seen "First comment", it could have clued me off to the issue -- as is, I was just staring for a bit.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nlneas1 picture nlneas1  Â·  7Comments

JoFAM picture JoFAM  Â·  7Comments

coolbutuseless picture coolbutuseless  Â·  12Comments

lukaszbednarz picture lukaszbednarz  Â·  11Comments

MaksimRudnev picture MaksimRudnev  Â·  6Comments