| Title: | Plumber API to report package structure and function |
|---|---|
| Description: | Plumber API to report package structure and function. |
| Authors: | Mark Padgham [aut, cre] (ORCID: <https://orcid.org/0000-0003-2172-5265>) |
| Maintainer: | Mark Padgham <[email protected]> |
| License: | GPL-3 |
| Version: | 0.2.0.034 |
| Built: | 2026-05-04 08:45:32 UTC |
| Source: | https://github.com/ropensci-review-tools/roreviewapi |
Check whether a package has been cached, and if so, whether commits have been added to the github repo since cached version.
check_cache(org, repo, cache_dir = fs::path_temp())check_cache(org, repo, cache_dir = fs::path_temp())
org |
Github organization |
repo |
Github repository |
cache_dir |
Directory in which packages are cached |
FALSE If a package has previously been cached, and the github repo has not changed; otherwise TRUE.
This function is not intended to be called directly, and is only exported to enable it to be used within the plumber API.
Other utils:
pkgrep_install_deps(),
stdout_stderr_cache(),
symbol_crs(),
symbol_tck()
Check template variables in GitHub issue
check_issue_template(orgrepo, issue_num)check_issue_template(orgrepo, issue_num)
orgrepo |
GitHub organization and repo as single string separated by
forward slash ( |
issue_num |
Number of issue from which to extract opening comment |
Comment as character string
Other ropensci:
is_user_authorized(),
issue_is_stats(),
push_to_gh_pages(),
readme_has_peer_review_badge(),
srr_counts(),
srr_counts_from_report(),
srr_counts_summary(),
stats_badge()
Collate list of checks to single concatenated character string
collate_editor_check(checks)collate_editor_check(checks)
checks |
Result of |
Single character
Exported only for access by plumber; not intended for general external usage.
Other main:
editor_check(),
pkgmatch_repo(),
serve_api()
This function is exported because it needs to be called in the main plumber endpoint function.
cran_to_list(matches, n = 5L)cran_to_list(matches, n = 5L)
matches |
A pkgmatch |
n |
Number of matches to return in list. |
Sets active = 0 first as a guard against concurrent clicks, then
deletes all recipient rows followed by the search row itself.
deactivate_search(repo, issue_id)deactivate_search(repo, issue_id)
repo |
GitHub review repository in |
issue_id |
Integer issue number in the review repository. |
Named list with deactivated (logical) and issue_ref.
Download a GitHub repo to local cache
dl_gh_repo(u, branch = NULL)dl_gh_repo(u, branch = NULL)
u |
URL of GitHub repository |
branch |
Checkout specified (non-default) branch of repo. |
Path to locally cached '.zip' version of repository
Other github:
get_branch_from_url(),
get_subdir_from_url(),
post_to_issue(),
url_is_r_pkg()
Body of main 'editorcheck' response
editor_check(repourl, repo, issue_id, post_to_issue = TRUE)editor_check(repourl, repo, issue_id, post_to_issue = TRUE)
repourl |
The URL for the repo being checked, potentially including full path to non-default branch. |
repo |
The 'context.repo' parameter defining the repository from which the command was invoked, passed in 'org/repo' format. |
issue_id |
The id (number) of the issue from which the command was invoked. |
post_to_issue |
Integer value > 0 will post results back to issue (via 'gh' cli); otherwise just return character string with result. |
If !post_to_issue, a markdown-formatted response body from static
package checks, otherwise URL of the issue comment to which response body has
been posted.
Other main:
collate_editor_check(),
pkgmatch_repo(),
serve_api()
Get branch from a GitHub URL if non-default branch specified there
get_branch_from_url(repourl)get_branch_from_url(repourl)
repourl |
Potentially with "/tree/branch_name/sub-directory" appended |
Branch as single string.
Other github:
dl_gh_repo(),
get_subdir_from_url(),
post_to_issue(),
url_is_r_pkg()
Return sub-directory from URL if present. This function is also intended to test whether packages are in sub-directories (issue #64)
get_subdir_from_url(repourl)get_subdir_from_url(repourl)
repourl |
Potentially with "/tree/branch_name/sub-directory" appended |
Other github:
dl_gh_repo(),
get_branch_from_url(),
post_to_issue(),
url_is_r_pkg()
Looks up the token, checks whether the parent search is still active, guards against double-clicks, records the click timestamp, and triggers a Postmark notification (Phase 2).
handle_click(token)handle_click(token)
token |
64-character hex token from the recipient's unique link. |
Named list with status (integer HTTP status code) and
body (character HTML string).
This function is used only in the plumber endpoints, to prevent them being called by unauthorized users.
is_user_authorized(secret = NULL)is_user_authorized(secret = NULL)
secret |
Environment variable |
Logical value indicating whether or not a user is authorized.
Other ropensci:
check_issue_template(),
issue_is_stats(),
push_to_gh_pages(),
readme_has_peer_review_badge(),
srr_counts(),
srr_counts_from_report(),
srr_counts_summary(),
stats_badge()
Determine whether a GitHub issue is a Stats submission
issue_is_stats(orgrepo, issue_num)issue_is_stats(orgrepo, issue_num)
orgrepo |
GitHub organization and repo as single string separated by
forward slash ( |
issue_num |
Number of issue from which to extract submission type. |
TRUE if the submission type is "Stats", otherwise FALSE.
Other ropensci:
check_issue_template(),
is_user_authorized(),
push_to_gh_pages(),
readme_has_peer_review_badge(),
srr_counts(),
srr_counts_from_report(),
srr_counts_summary(),
stats_badge()
List all volunteer searches with recipient and click counts
list_searches()list_searches()
Data frame with columns search_id, created_at,
notify_email, active, total, clicked.
Body of main 'pkgmatch' response
pkgmatch_repo(repourl, repo, issue_id, n_top = 5L, post_to_issue = TRUE)pkgmatch_repo(repourl, repo, issue_id, n_top = 5L, post_to_issue = TRUE)
repourl |
The URL for the repo being matched, potentially including full path to non-default branch. |
repo |
The 'context.repo' parameter defining the repository from which the command was invoked, passed in 'org/repo' format. |
issue_id |
The id (number) of the issue from which the command was invoked. |
n_top |
Return this number of top-matches packages. |
post_to_issue |
Integer value > 0 will post results back to issue (via 'gh' cli); otherwise just return character string with result. |
If !post_to_issue, a markdown-formatted response body, otherwise
URL of the issue comment to which response body has been posted.
Other main:
collate_editor_check(),
editor_check(),
serve_api()
Install all system and package dependencies of an R package
pkgrep_install_deps(path, repo, issue_id)pkgrep_install_deps(path, repo, issue_id)
path |
Path to local file or directory |
repo |
The 'context.repo' parameter defining the repository from which the command was invoked, passed in 'org/repo' format. |
issue_id |
The id (number) of the issue from which the command was invoked. |
Hopefully a character vector of length zero, otherwise a message detailing any R packages unable to be installed.
Other utils:
check_cache(),
stdout_stderr_cache(),
symbol_crs(),
symbol_tck()
Post review checks to GitHub issue
post_to_issue(cmt, repo, issue_id)post_to_issue(cmt, repo, issue_id)
cmt |
Single character string with comment to post. |
repo |
The repository to post to (obtained directly from bot). |
issue_id |
The number of the issue to post to. |
URL of the comment within the nominated issue
Other github:
dl_gh_repo(),
get_branch_from_url(),
get_subdir_from_url(),
url_is_r_pkg()
html files to gh-pages branch of this repo to serve via
GitHub pages.Push static html files to gh-pages branch of this repo to serve via
GitHub pages.
push_to_gh_pages(check)push_to_gh_pages(check)
check |
Return result of editor_check function. |
Vector of two paths containing URLs of the srr and network files.
Other ropensci:
check_issue_template(),
is_user_authorized(),
issue_is_stats(),
readme_has_peer_review_badge(),
srr_counts(),
srr_counts_from_report(),
srr_counts_summary(),
stats_badge()
Check whether README.md features an rOpenSci software-review badge
readme_badge(repourl, repo = NULL, issue_id = NULL, post_to_issue = TRUE)readme_badge(repourl, repo = NULL, issue_id = NULL, post_to_issue = TRUE)
repourl |
The URL for the repo being checked, potentially including full path to non-default branch. |
repo |
The 'context.repo' parameter defining the repository from which the command was invoked, passed in 'org/repo' format. |
issue_id |
The id (number) of the issue from which the command was invoked. |
post_to_issue |
Integer value > 0 will post results back to issue (via 'gh' cli); otherwise just return character string with result. |
A string, empty if the badge was found.
Check whether 'README.md' has a "peer reviewed" badge
readme_has_peer_review_badge(path = getwd(), issue_id = NULL)readme_has_peer_review_badge(path = getwd(), issue_id = NULL)
path |
Local path to package directory. |
issue_id |
The id (number) of the issue from which the command was invoked. |
A string, empty if the badge was found.
Other ropensci:
check_issue_template(),
is_user_authorized(),
issue_is_stats(),
push_to_gh_pages(),
srr_counts(),
srr_counts_from_report(),
srr_counts_summary(),
stats_badge()
This function is exported because it needs to be called in the main plumber endpoint function.
ros_to_list(matches, n = 5L)ros_to_list(matches, n = 5L)
matches |
A pkgmatch |
n |
Number of matches to return in list. |
Fetches current editor email addresses via get_editor_emails(), inserts
a new search record and one recipient row per address into the database, then
dispatches emails via Postmark. The notify address is read from the
AirTable cache written by the internal 'notify_email_refresh' function. The
base URL for click links is read from the ROREVIEWAPI_BASE_URL
environment variable. The stats/standard distinction is determined by
calling issue_is_stats() on the supplied repo and
issue_id.
send_search( repourl, repo, issue_id, subject = "Seeking editors for rOpenSci software submission", fetcher = get_editor_emails, stats_checker = issue_is_stats )send_search( repourl, repo, issue_id, subject = "Seeking editors for rOpenSci software submission", fetcher = get_editor_emails, stats_checker = issue_is_stats )
repourl |
URL of the package repository; included in the outgoing emails. |
repo |
GitHub review repository in |
issue_id |
Integer issue number in the review repository. |
subject |
Subject line for the outgoing emails. |
fetcher |
Function used to fetch editor emails; injectable for testing.
Must accept |
stats_checker |
Function used to determine submission type; injectable
for testing. Must accept |
Named list with search_id (integer) and sent (integer).
The API exposes the single POST points of report to download software from
the given URL and return a textual analysis of its structure and
functionality.
serve_api(port = 8000L, cache_dir = NULL, os = "", os_release = "")serve_api(port = 8000L, cache_dir = NULL, os = "", os_release = "")
port |
Port for API to be exposed on |
cache_dir |
Directory where previously downloaded repositories are cached |
os |
Name of operating system, passed to remotes package to install system dependencies. |
os_release |
Name of operating system release, passed to remotes package to install system dependencies. |
Nothing; calling this starts a blocking process.
Other main:
collate_editor_check(),
editor_check(),
pkgmatch_repo()
Count number of 'srr' statistical standards complied with, and confirm whether than represents > 50% of all applicable standards.
srr_counts(repourl, repo, issue_id, post_to_issue = TRUE)srr_counts(repourl, repo, issue_id, post_to_issue = TRUE)
repourl |
The URL for the repo being checked, potentially including full path to non-default branch. |
repo |
The 'context.repo' parameter defining the repository from which the command was invoked, passed in 'org/repo' format. |
issue_id |
The id (number) of the issue from which the command was invoked. |
post_to_issue |
Integer value > 0 will post results back to issue (via 'gh' cli); otherwise just return character string with result. |
Vector of three numbers:
Number of standards complied with
Total number of applicable standards
Number complied with as proportion of total
Other ropensci:
check_issue_template(),
is_user_authorized(),
issue_is_stats(),
push_to_gh_pages(),
readme_has_peer_review_badge(),
srr_counts_from_report(),
srr_counts_summary(),
stats_badge()
Extract final counts of 'srr' standards from the report
srr_counts_from_report(srr_rep)srr_counts_from_report(srr_rep)
srr_rep |
An 'srr' report generated by the |
Character vector with markdown-formatted summary summary of numbers of standards complied with.
Other ropensci:
check_issue_template(),
is_user_authorized(),
issue_is_stats(),
push_to_gh_pages(),
readme_has_peer_review_badge(),
srr_counts(),
srr_counts_summary(),
stats_badge()
Summarise counts of 'srr' standards from full 'srr' report
srr_counts_summary(srr_rep, has_errors = FALSE)srr_counts_summary(srr_rep, has_errors = FALSE)
srr_rep |
An 'srr' report generated by the |
has_errors |
This is |
Character vector with markdown-formatted summary summary of numbers of standards complied with.
Other ropensci:
check_issue_template(),
is_user_authorized(),
issue_is_stats(),
push_to_gh_pages(),
readme_has_peer_review_badge(),
srr_counts(),
srr_counts_from_report(),
stats_badge()
Get stats badge grade and standards version for a submission
stats_badge(repo = "ropensci/software-review", issue_num = 258)stats_badge(repo = "ropensci/software-review", issue_num = 258)
repo |
The submission repo |
issue_num |
GitHub issue number of submission |
A single character containing the label used directly for the issue badge
Other ropensci:
check_issue_template(),
is_user_authorized(),
issue_is_stats(),
push_to_gh_pages(),
readme_has_peer_review_badge(),
srr_counts(),
srr_counts_from_report(),
srr_counts_summary()
r_bg processSet up stdout & stderr cache files for r_bg process
stdout_stderr_cache(repourl)stdout_stderr_cache(repourl)
repourl |
The URL of the repo being checked |
Vector of two strings holding respective local paths to stdout and
stderr files for r_bg process controlling the main editor_check
function.
These files are needed for the callr r_bg process which
controls the main editor_check call. See
https://github.com/r-lib/callr/issues/204. The stdout and stderr
pipes from the process are stored in the cache directory so they can be
inspected via their own distinct endpoint calls.
Other utils:
check_cache(),
pkgrep_install_deps(),
symbol_crs(),
symbol_tck()
Cross symbol, exported for direct use in plumber API
symbol_crs()symbol_crs()
Other utils:
check_cache(),
pkgrep_install_deps(),
stdout_stderr_cache(),
symbol_tck()
Tick symbol, exported for direct use in plumber API
symbol_tck()symbol_tck()
Other utils:
check_cache(),
pkgrep_install_deps(),
stdout_stderr_cache(),
symbol_crs()
Check whether a given GitHub URL contains an R package.
url_is_r_pkg(repourl)url_is_r_pkg(repourl)
repourl |
Potentially with "/tree/branch_name/sub-directory" appended |
TRUE if 'repourl' is an R package, otherwise FALSE
Other github:
dl_gh_repo(),
get_branch_from_url(),
get_subdir_from_url(),
post_to_issue()