Skip to content

Commit

Permalink
Add some warnings in conversion metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
damianooldoni committed Jul 17, 2023
1 parent 93253a1 commit d80df4d
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -502,12 +502,42 @@ convert_to_0.1.6 <- function(package, from = "1.0-rc.1"){
#' @noRd
#' @importFrom dplyr %>% .data
convert_metadata_to_0.1.6 <- function(package, from = "1.0-rc.1"){
authors <- purrr::map_df(package$contributors, unlist)
if ("role" %in% names(authors)) {
deprecated_roles <- c("author", "maintainer")
if (any(deprecated_roles %in% authors$role)) {
warning(paste0(
"Roles ",
glue::glue_collapse(glue::glue("{deprecated_roles}"),
sep = " ",
last = " and "),
" are deprecated in ",
"version {from}."
)
)
}
}
if ("organizations" %in% names(package)) {
warning(glue::glue(
"The field `organizations` is deprecated in ",
"version {from}."
)
)
}
if ("animalTypes" %in% names(package)) {
warning(glue::glue(
"The field `animalTypes` is deprecated in",
"version {from}."
)
)
}
names(package)[names(package) == "observationLevel"] <- "classificationLevel"
if ("sequenceInterval" %in% names(package)) {
warning(glue::glue("sequenceInterval is deprecated in version ",
"{from}: removed from package.")
if ("sequenceInterval" %in% names(package$project)) {
warning(glue::glue(
"The field `sequenceInterval` is deprecated in",
"version {from}."
)
)
package$sequenceInterval <- NULL
}
package$platform <- package$sources[[1]]$title
# `title` value of the first contributor with role `rightsHolder`
Expand Down

0 comments on commit d80df4d

Please sign in to comment.