From d6da95b8ecc0913a89b435afb9995be852542fef Mon Sep 17 00:00:00 2001 From: mpadge Date: Wed, 7 Feb 2024 11:05:22 +0100 Subject: [PATCH] add internal fn docs; closes #2 --- DESCRIPTION | 2 +- R/dashboard-fn.R | 3 ++- R/gh-query.R | 17 +++++++++++++---- R/gt-table.R | 9 +++++++++ codemeta.json | 2 +- 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 303b588..228c304 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: dashboard Title: What the Package Does (One Line, Title Case) -Version: 0.0.0.009 +Version: 0.0.0.010 Authors@R: person(given = "First", family = "Last", diff --git a/R/dashboard-fn.R b/R/dashboard-fn.R index ed76318..ac9d1c2 100644 --- a/R/dashboard-fn.R +++ b/R/dashboard-fn.R @@ -1,6 +1,7 @@ #' Apply the query above to extract data from GitHub GraphQL API, and #' post-process into a `data.frame`. #' +#' @param open_only Include only open issues? #' @return (Invisibly) A `data.frame` with one row per issue and some key #' statistics. #' @noRd @@ -21,7 +22,7 @@ dashboard_gh_data <- function (open_only = TRUE) { while (has_next_page) { - q <- get_issues_qry ( + q <- gh_issues_qry ( org = "ropensci", repo = "software-review", open_only = open_only, diff --git a/R/gh-query.R b/R/gh-query.R index 60dd714..9bb06f1 100644 --- a/R/gh-query.R +++ b/R/gh-query.R @@ -6,10 +6,19 @@ get_gh_token <- function (token = "") { ) } -get_issues_qry <- function (org = "ropensci", - repo = "software-review", - open_only = TRUE, - end_cursor = NULL) { +#' The GitHub GraphQL query. +#' +#' @param org The GitHub organization. +#' @param repo The GitHub repository. +#' @param open_only Include only open issues? +#' @param end_cursor The end cursor from the previous query. +#' +#' @return The GraphQL query to pass to a `gh::gh_gql()` call. +#' @noRd +gh_issues_qry <- function (org = "ropensci", + repo = "software-review", + open_only = TRUE, + end_cursor = NULL) { after_txt <- "" if (!is.null (end_cursor)) { diff --git a/R/gt-table.R b/R/gt-table.R index ef24445..be9a2f2 100644 --- a/R/gt-table.R +++ b/R/gt-table.R @@ -1,3 +1,12 @@ +#' Open a \pkg{gt} table in the default browser. +#' +#' This function is called internally from the \code{\link{dashboard}} function +#' if the `browse` argument is set to `TRUE`. +#' +#' @param dat The `data.frame` returned from the \code{\link{dashboard}} function. +#' @return Nothing; function called for side-effect only of opening \pkg{gt} table. +#' +#' @noRd open_gt_table <- function (dat) { # Suppress no visible binding notes: diff --git a/codemeta.json b/codemeta.json index 5129b61..0421594 100644 --- a/codemeta.json +++ b/codemeta.json @@ -6,7 +6,7 @@ "name": "dashboard: What the Package Does (One Line, Title Case)", "codeRepository": "https://github.com/ropensci-review-tools/dashboard", "license": "https://spdx.org/licenses/MIT", - "version": "0.0.0.009", + "version": "0.0.0.010", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R",