Skip to content

Commit 187deb9

Browse files
committed
fix some warnings and notes from package check
1 parent f80b4ab commit 187deb9

16 files changed

+87
-67
lines changed

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ Depends: R (>= 4.0.0), gh, R.cache, parsedate
2929
Imports:
3030
dplyr,
3131
tidyr,
32-
magrittr,
3332
yaml,
3433
xtable,
3534
stringr,

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ importFrom(rmarkdown,render)
4040
importFrom(rorcid,check_dois)
4141
importFrom(stringr,str_match)
4242
importFrom(stringr,str_replace_all)
43+
importFrom(utils,askYesNo)
4344
importFrom(utils,capture.output)
4445
importFrom(utils,read.csv)
4546
importFrom(utils,tail)

R/codecheck.R

Lines changed: 51 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -271,24 +271,27 @@ cite_certificate <- function(metadata) {
271271

272272
# Zenodo records interaction ----
273273

274-
##' Create a new Zenodo record and return its pre-assigned DOI
275-
##'
276-
##' Run this only once per new codecheck.
277-
##' @title Create a new Zenodo record and return its pre-assigned DOI
278-
##' @param zen - Object from zen4R to interact with Zenodo
279-
##' @return Number of zenodo record created.
280-
##' @author Stephen Eglen
281-
##' @importFrom zen4R ZenodoRecord
282-
##'
283-
##' @export
274+
#' Create a new Zenodo record and return its pre-assigned DOI
275+
#'
276+
#' Run this only once per new codecheck.
277+
#' @title Create a new Zenodo record and return its pre-assigned DOI
278+
#' @param zen Object from zen4R to interact with Zenodo
279+
#' @param metadata codecheck.yml file
280+
#' @param warn Ask for user input before creating a new record
281+
#' @return Number of Zenodo record created
282+
#' @author Stephen Eglen
283+
#' @importFrom zen4R ZenodoRecord
284+
#' @importFrom utils askYesNo
285+
#'
286+
#' @export
284287
get_or_create_zenodo_record <- function(zen, metadata, warn=TRUE) {
285288
id <- get_zenodo_record(metadata$report)
286289
if (!is.na(id)) {
287290
my_rec <- zen$getDepositionById(id)
288291
} else {
289292
## no record, create a new one.
290293
if(warn) {
291-
proceed <- askYesNo("You do not have a zenodo record; I can fix this for you but please make sure your codecheck.yaml is saved, as I will need to update it. Proceed?")
294+
proceed <- askYesNo("You do not have a Zenodo record yet; I can fix this for you but please make sure your codecheck.yaml is saved, as I will need to update it. Proceed?")
292295
stopifnot(proceed==TRUE)
293296
}
294297
my_rec <- zen$createEmptyRecord()
@@ -330,17 +333,17 @@ get_zenodo_id <- function(report) {
330333
as.integer(result)
331334
}
332335

333-
##' Get the full Zenodo record from the metadata
334-
##'
335-
##' Retrieve the zenodo record, if one exists.
336-
##' If no record number is currently listed in the metadata (i.e. the "FIXME" tag is still there)
337-
##' then the code returns NULL and an empty record should be created.
338-
##' @title Get the full zenodo record using the record number stored in the metadata.
339-
##' @param zenodo
340-
##' @param metadata
341-
##' @return The Zenodo record, or NULL.
342-
##' @author Stephen Eglen
343-
##' @export
336+
#' Get the full Zenodo record from the metadata
337+
#'
338+
#' Retrieve the Zenodo record, if one exists.
339+
#' If no record number is currently listed in the metadata (i.e. the "FIXME" tag is still there)
340+
#' then the code returns NULL and an empty record should be created.
341+
#' @title Get the full zenodo record using the record number stored in the metadata.
342+
#' @param zenodo An object from zen4R to connect with Zenodo
343+
#' @param metadata A codecheck configuration (likely read from a codecheck.yml)
344+
#' @return The Zenodo record, or NULL.
345+
#' @author Stephen Eglen
346+
#' @export
344347
get_zenodo_record <- function(zenodo, metadata) {
345348
id <- get_zenodo_id(metadata$report)
346349
if (is.na(id)) {
@@ -350,18 +353,18 @@ get_zenodo_record <- function(zenodo, metadata) {
350353
}
351354
}
352355

353-
##' Upload codecheck metadata to Zenodo.
354-
##'
355-
##' The contents of codecheck.yml are uploaded to Zenodo using this funciton.
356-
##'
357-
##' @title Upload metadata to Zenodod
358-
##' @param zen
359-
##' @param myrec
360-
##' @param metadata
361-
##' @return rec -- the updated record.
362-
##' @author Stephen Eglen
363-
##' @export
364-
upload_zenodo_metadata <- function(zen, myrec, metadata) {
356+
#' Upload codecheck metadata to Zenodo.
357+
#'
358+
#' The contents of codecheck.yml are uploaded to Zenodo using this funciton.
359+
#'
360+
#' @title Upload metadata to Zenodod
361+
#' @param zenodo object from zen4R to connect with Zenodo
362+
#' @param myrec a Zenodo record object
363+
#' @param metadata codecheck metadata, likely loaded from a codecheck.yml file
364+
#' @return rec -- the updated record.
365+
#' @author Stephen Eglen
366+
#' @export
367+
upload_zenodo_metadata <- function(zenodo, myrec, metadata) {
365368
##draft$setPublicationType("report")
366369
##draft$setCommunities(communities = c("codecheck"))
367370
myrec$metadata <- NULL
@@ -394,23 +397,23 @@ upload_zenodo_metadata <- function(zen, myrec, metadata) {
394397
##myrec$addRelatedIdentifier(relation = "isSupplementTo", identifier = metadata$repository)
395398
##myrec$addRelatedIdentifier(relation = "isSupplementTo", identifier = metadata$paper$reference)
396399
cat(paste0("Check your record online at ", myrec$links$self_html, "\n"))
397-
myrec <- zen$depositRecord(myrec)
400+
myrec <- zenodo$depositRecord(myrec)
398401

399402
}
400403

401404

402-
##' Upload the CODECHECK certificate to Zenodo.
403-
##'
404-
##' Upload the CODECHECK certificate to Zenodo as a draft. Warning: if
405-
##' the file has already been uploaded once, you will need to delete it via
406-
##' the web interface before being able to upload a new versin.
407-
##' @title Upload the CODECHECK certificate to Zenodo.
408-
##' @param zen - Object from zen4R to interact with Zenodo
409-
##' @param record - string containing the report URL on Zenodo.
410-
##' @param certificate name of the PDF file.
411-
##' @return NULL
412-
##' @author Stephen Eglen
413-
##' @export
405+
#' Upload the CODECHECK certificate to Zenodo.
406+
#'
407+
#' Upload the CODECHECK certificate to Zenodo as a draft. Warning: if
408+
#' the file has already been uploaded once, you will need to delete it via
409+
#' the web interface before being able to upload a new versin.
410+
#' @title Upload the CODECHECK certificate to Zenodo.
411+
#' @param zen - Object from zen4R to interact with Zenodo
412+
#' @param record - string containing the report URL on Zenodo.
413+
#' @param certificate name of the PDF file.
414+
#' @return NULL
415+
#' @author Stephen Eglen
416+
#' @export
414417
set_zenodo_certificate <- function(zen, record, certificate) {
415418
draft <- zen$getDepositionById(record)
416419
stopifnot(file.exists(certificate))
@@ -426,7 +429,7 @@ add_id_to_yml <- function(id, yml_file) {
426429
## Add id to the yaml file.
427430
data1 <- readLines(yml_file)
428431
data2 <- gsub(pattern = "zenodo.FIXME$",
429-
replace = paste0("zenodo.",id),
432+
replacement = paste0("zenodo.",id),
430433
x = data1)
431434
writeLines(data2, yml_file)
432435
}

R/register.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#' - `.md``
77
#'
88
#' @param register A `data.frame` with all required information for the register's view
9+
#' @param filter_by The filter or list o filters (if applicable)
910
#' @param outputs The output formats to create
1011
#' @param config A list of configuration files to be sourced at the beginning of the rending process
1112
#'

R/utils_preprocess_register.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,10 @@ create_temp_register_with_codechecker <- function(register_table){
202202
}
203203

204204
#' Function for preprocessing the register to create and return the preprocessed register table.
205-
#' @param register The register
205+
#'
206+
#' @param register The register.
207+
#' @param filter_by The filter (if applicable).
208+
#'
206209
#' @return The preprocessed register table
207210
preprocess_register <- function(register, filter_by) {
208211
register_table <- register
@@ -220,4 +223,4 @@ preprocess_register <- function(register, filter_by) {
220223
register_table <- add_check_time(register_table, register)
221224
register_table <- add_paper_links(register_table, register)
222225
return(register_table)
223-
}
226+
}

R/utils_render_cert_md.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ create_cert_md <- function(cert_id, repo_link, download_cert_status){
254254
#'
255255
#' @param md_content A character string containing the Markdown template content with placeholders.
256256
#' @param repo_link A character string containing the repository link associated with the certificate.
257+
#' @param download_cert_status An integer (0 or 1) indicating whether the certificate PDF was downloaded (1) or not (0).
257258
#' @return The markdown content, with paper details placeholders filled.
258259
add_paper_details_md <- function(md_content, repo_link, download_cert_status){
259260
config_yml <- get_codecheck_yml(repo_link)

R/utils_render_table_non_registers.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ generate_html_title_non_registers <- function(filter, subcat){
172172
#' There is only extra text for the codecheckers HTML page to explain
173173
#' the reason for discrepancy between total_codechecks != SUM(no.of codechecks)
174174
#'
175-
#' @param filter The filter
175+
#' @param filter A string specifying the filter applied (e.g., "venues", "codecheckers").
176176
#' @return The extra text to place under the table
177177
generate_html_extra_text_non_register <- function(filter){
178178
extra_text <- ""
@@ -188,8 +188,8 @@ generate_html_extra_text_non_register <- function(filter){
188188
#' the number of codechecks and number of codechecks/ venues etc.
189189
#'
190190
#' @param table The table to showcase in the html
191-
#' @param page_type The HTML page type that needs to rendered
192-
#' @param table_name The name of the table
191+
#' @param filter A string specifying the filter applied (e.g., "venues", "codecheckers").
192+
#' @param subcat An optional string for the subcategory (if applicable).
193193
#' @return The subtext to put under the html title
194194
generate_html_subtext_non_register <- function(table, filter, subcat = NULL){
195195
# The filter is in the CONFIG$NON_REG_SUBTEXT

inst/extdata/config.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
CONFIG <- new.env()
22

3+
utils::globalVariables(c("CONFIG"))
4+
35
# REGISTER TABLE
46

57
# Specifying the register table column widths

man/add_paper_details_md.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/generate_html_extra_text_non_register.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)