Title: | Plumber API to report package structure and function |
---|---|
Description: | Plumber API to report package structure and function. |
Authors: | Mark Padgham [aut, cre] |
Maintainer: | Mark Padgham <[email protected]> |
License: | GPL-3 |
Version: | 0.1.1.002 |
Built: | 2024-11-19 16:29:34 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()
,
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()
,
serve_api()
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()
,
post_to_issue()
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()
,
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()
,
post_to_issue()
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 |
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()
,
push_to_gh_pages()
,
readme_has_peer_review_badge()
,
srr_counts()
,
srr_counts_from_report()
,
srr_counts_summary()
,
stats_badge()
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()
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()
,
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()
,
push_to_gh_pages()
,
srr_counts()
,
srr_counts_from_report()
,
srr_counts_summary()
,
stats_badge()
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()
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()
,
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()
,
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()
,
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()
,
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()