Skip to content

Commit 9f2985f

Browse files
committed
pass 'n_per_page' param to all fn calls in cm-data.R for #23
1 parent a60dd22 commit 9f2985f

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: repometrics
22
Title: Metrics for Your Code Repository
3-
Version: 0.1.1.089
3+
Version: 0.1.1.090
44
Authors@R:
55
person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-2172-5265"))

R/cm-data-gh-prs.R

+6-4
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,19 @@ gh_prs_qry <- function (org = "ropensci-review-tools",
110110
cm_data_prs_from_gh_api_internal <- function (path, n_per_page = 30L) {
111111

112112
is_test_env <- Sys.getenv ("REPOMETRICS_TESTS") == "true"
113-
if (is_test_env) {
114-
n_per_page <- 2L
115-
}
116113

117114
or <- org_repo_from_path (path)
118115
end_cursor <- pr_data <- NULL
119116
has_next_page <- TRUE
120117

121118
while (has_next_page) {
122119

123-
q <- gh_prs_qry (org = or [1], repo = or [2], end_cursor = end_cursor, n_per_page = n_per_page)
120+
q <- gh_prs_qry (
121+
org = or [1],
122+
repo = or [2],
123+
end_cursor = end_cursor,
124+
n_per_page = n_per_page
125+
)
124126
dat <- gh::gh_gql (query = q)
125127

126128
pr_data <- c (pr_data, dat$data$repository$pullRequests$nodes)

R/cm-data.R

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
cm_data <- function (path) {
1+
cm_data <- function (path, n_per_page = 30L) {
2+
3+
checkmate::assert_directory_exists (path)
4+
checkmate::assert_integerish (n_per_page, lower = 1L, len = 1L)
25

36
data_fns <- get_cm_data_fns ()
47

58
if (all_cm_data_fns_memoised (data_fns, path)) {
69
res <- lapply (data_fns, function (i) {
7-
do.call (i, list (path))
10+
do.call (i, list (path = path, n_per_page = n_per_page))
811
})
912
} else {
1013
res <- pbapply::pblapply (data_fns, function (i) {
11-
do.call (i, list (path))
14+
do.call (i, list (path = path, n_per_page = n_per_page))
1215
})
1316
}
1417
names (res) <- gsub ("^cm\\_data\\_", "", data_fns)

codemeta.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"codeRepository": "https://github.com/ropensci-review-tools/repometrics",
99
"issueTracker": "https://github.com/ropensci-review-tools/repometrics/issues",
1010
"license": "https://spdx.org/licenses/GPL-3.0",
11-
"version": "0.1.1.089",
11+
"version": "0.1.1.090",
1212
"programmingLanguage": {
1313
"@type": "ComputerLanguage",
1414
"name": "R",

0 commit comments

Comments
 (0)