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

New rd_section_minidesc error with roxygen2 7.2.1 #1421

Closed
mjsteinbaugh opened this issue Aug 18, 2022 · 5 comments
Closed

New rd_section_minidesc error with roxygen2 7.2.1 #1421

mjsteinbaugh opened this issue Aug 18, 2022 · 5 comments
Labels
bug an unexpected problem or unintended behavior rd ✍️

Comments

@mjsteinbaugh
Copy link

mjsteinbaugh commented Aug 18, 2022

With the roxygen2 7.2.1 update, I'm now seeing this error in one of my packages, and I'm having trouble locating the source:

Error in rd_section_minidesc(name = object_name(block$object), desc = tag$val$description,  :
  is_string(name) is not TRUE
Calls: <Anonymous> ... <Anonymous> -> inherits -> rd_section_minidesc -> stopifnot
Backtrace:
     ▆
  1. └─devtools::document()
  2.   └─roxygen2::roxygenise(pkg$path, roclets)
  3.     └─base::lapply(...)
  4.       ├─roxygen2 (local) FUN(X[[i]], ...)
  5.       └─roxygen2:::roclet_process.roclet_rd(X[[i]], ...)
  6.         ├─roxygen2:::block_to_rd(block, base_path, env)
  7.         └─roxygen2:::block_to_rd.roxy_block(block, base_path, env)
  8.           └─roxygen2:::topic_add_describe_in(rd, block, env)
  9.             ├─topic$add(...)
 10.             │ └─base::inherits(x, "RoxyTopic")
 11.             └─roxygen2:::rd_section_minidesc(...)
 12.               └─base::stopifnot(is_string(name))

Any ideas on how to improve the stack trace here? Would it be possible to modify the error handling to return which file is problematic?

Best,
Mike

@gaborcsardi
Copy link
Member

Use options(error = recover) and then try to find more info interactively in the roxygen2 frames.

@mjsteinbaugh
Copy link
Author

Cool thanks I'll try that!

@VLucet
Copy link

VLucet commented Aug 22, 2022

I'm running into the same issue.

I think it is related to a @describeIn tag. Using @gaborcsardi's suggestion above I think I tracked it down to that line:

name = object_name(block$object),

This returns NULL instead of a string, and roxygen2:::rd_section_minidesc(...) chokes expecting is_string(name) to be true. In this case I would assume that object_name() should return the equivalent of block$object$topic, the topic in which the block should be described.

For context, below is the code that lead to the issue. For that block the output of block$object$topic is "sspm_discrete_boundary-class".

See code
# -------------------------------------------------------------------------

#' sspm boundary structure
#'
#' One of the first step in the `sspm` workflow is to create one or more
#' object(s) of class `sspm_boundary` from an `sf` object.
#'
#' @slot boundaries **\[sf\]** Spatial boundaries (polygons).
#' @slot boundary **\[character\]** The column of `data` that represents the
#'     spatial boundaries.
#' @slot boundary_area **\[character\]** The column of `data` that represents the
#'     area of spatial boundaries.
#' @slot method **\[[discretization_method][discretization_method-class]\]**
#'     *(if discrete)* discretization method used.
#' @slot patches **\[sf\]** *(if discrete)* Patches resulting from
#'     discretization.
#' @slot points **\[sf or NULL\]** *(if discrete)* Sample points used for
#'     discretization.
#' @slot patches_area **\[character\]** The column of `data` that represents the
#'     area of patches.
#'
#' @name sspm_boundary-class
#' @rdname sspm_boundary-class
#'
setClass("sspm_boundary",
         slots = list(boundaries = "sf",
                      boundary = "character",
                      boundary_area = "character")
)

#' @describeIn sspm_boundary-class sspm_discrete_boundary
setClass("sspm_discrete_boundary",
         slots = list(method = "discretization_method",
                      patches_area = "character",
                      patches = "sf",
                      points = "ANY"),
         contains = "sspm_boundary"
)

@ralmond
Copy link

ralmond commented Jun 21, 2023

I'm running into this same issue. It is really hard to track, especially as I'm not even given a file name, so I don't know where to start. There needs to be better handling of context information when running into even an unexpected error.

@hadley hadley added bug an unexpected problem or unintended behavior rd ✍️ labels Nov 2, 2023
@hadley
Copy link
Member

hadley commented Nov 21, 2023

This should be better in the dev version, but no one provided a reprex, so I can't be sure.

@hadley hadley closed this as completed Nov 21, 2023
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
Development

No branches or pull requests

5 participants