Skip to content

Commit cc6a3ef

Browse files
authored
Merge pull request #54 from ropensci-review-tools/user
user data
2 parents b3a70d8 + 159b4bf commit cc6a3ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1539
-196
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.2.042
3+
Version: 0.1.2.059
44
Authors@R:
55
person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-2172-5265"))

NAMESPACE

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Generated by roxygen2: do not edit by hand
22

3-
export(cm_data)
43
export(repo_pkgstats_history)
54
export(repometrics_dashboard)
65
export(repometrics_data)
6+
export(rm_data_repo)
7+
export(rm_data_user)
78
importFrom(memoise,memoise)

R/cm-metric-has-ci.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repo_has_ci_files <- function (path) {
2121

2222
has_gh_ci_tests <- function (path) {
2323

24-
ci_data <- cm_data_repo_from_gh_api (path)
24+
ci_data <- rm_data_repo_from_gh_api (path)
2525
h <- gert::git_log (repo = path, max = 1e6)
2626
any (ci_data$sha %in% h$commit)
2727
}

R/cm-metric-issues-to-prs.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cm_metric_issues_to_prs <- function (path, end_date = Sys.Date ()) {
1313

1414
get_issues_in_period <- function (path, end_date = Sys.Date (), closed_only = FALSE) {
1515

16-
issues <- cm_data_issues_from_gh_api (path)
16+
issues <- rm_data_issues_from_gh_api (path)
1717
closed_dates <- as.Date (issues$closed_at)
1818
start_date <- end_date - get_repometrics_period ()
1919

R/cm-metric-labels.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ cm_metric_label_inclusivity <- function (path, end_date = Sys.Date ()) {
2222
# suppress no visible binding notes:
2323
created_at <- NULL
2424

25-
issues_data <- cm_data_issues_from_gh_api (path)
25+
issues_data <- rm_data_issues_from_gh_api (path)
2626
issues_data$created_at <- as.Date (issues_data$created_at)
2727

2828
issues_data <- dplyr::filter (issues_data, created_at <= end_date)

R/cm-metric-libyears.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#' @noRd
55
cm_metric_libyears <- function (path) {
66

7-
deps <- cm_data_libyears (path)
7+
deps <- rm_data_libyears (path)
88

99
c (mean = mean (deps$libyears), median = stats::median (deps$libyears))
1010
}

R/cm-metric-num-forks.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cm_metric_num_forks <- function (path, end_date = Sys.Date ()) {
22

3-
forks <- cm_data_repo_forks (path)
3+
forks <- rm_data_repo_forks (path)
44

55
start_date <- end_date - get_repometrics_period ()
66
index <- which (forks$created >= start_date & forks$created <= end_date)

R/cm-metric-popularity.R

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ cm_metric_popularity <- function (path, end_date = Sys.Date ()) {
33
# suppress no visible binding notes:
44
timestamp <- aut_email <- aut_name <- created <- starred_at <- NULL
55

6-
revdeps <- cm_data_dependencies_downstream (path)
6+
revdeps <- rm_data_dependencies_downstream (path)
77

8-
forks <- cm_data_repo_forks (path) |>
8+
forks <- rm_data_repo_forks (path) |>
99
dplyr::filter (created <= end_date)
1010

11-
stars <- cm_data_repo_stargazers (path) |>
11+
stars <- rm_data_repo_stargazers (path) |>
1212
dplyr::filter (starred_at <= end_date)
1313

14-
log <- cm_data_gitlog (path) |>
14+
log <- rm_data_gitlog (path) |>
1515
dplyr::mutate (timestamp = as.Date (timestamp)) |>
1616
dplyr::filter (timestamp <= end_date)
1717
log_ctbs <- unique (log [, c ("aut_name", "aut_email")]) |>

R/cm-metric-release-freq.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cm_metric_release_freq <- function (path, end_date = Sys.Date ()) {
55

66
start_date <- end_date - get_repometrics_period ()
77

8-
releases <- cm_data_releases_from_gh_api (path) |>
8+
releases <- rm_data_releases_from_gh_api (path) |>
99
dplyr::mutate (published_at = as.Date (published_at)) |>
1010
dplyr::filter (published_at <= end_date)
1111

R/cm-metrics-change-req.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ cm_metric_change_req <- function (path, end_date = Sys.Date ()) {
2929

3030
get_prs_in_period <- function (path, end_date = Sys.Date ()) {
3131

32-
prs <- cm_data_prs_from_gh_api (path)
32+
prs <- rm_data_prs_from_gh_api (path)
3333
prs <- prs [which (prs$merged), ]
3434
closed_dates <- as.Date (prs$closed_at)
3535
start_date <- end_date - get_repometrics_period ()

R/cm-metrics-issue-response.R

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ cm_metric_issue_response_time <- function (path, end_date = Sys.Date ()) {
77
ctbs_main_all <- main_contributors (path, end_date = end_date, period = NULL)
88
ctbs_main <- unique (c (ctbs_main_recent, ctbs_main_all))
99

10-
issues <- cm_data_issues_from_gh_api (path)
10+
issues <- rm_data_issues_from_gh_api (path)
1111
issues <- issues [grep ("issues", issues$url), ]
12-
comments <- cm_data_issue_comments_from_gh_api (path)
12+
comments <- rm_data_issue_comments_from_gh_api (path)
1313

1414
cmt_responses <- dplyr::filter (comments, user_login %in% ctbs_main) |>
1515
dplyr::group_by (issue_number) |>
@@ -40,7 +40,7 @@ cm_metric_issue_response_time <- function (path, end_date = Sys.Date ()) {
4040

4141
cm_metric_defect_resolution_dur <- function (path, end_date = Sys.Date ()) {
4242

43-
issues <- cm_data_issues_from_gh_api (path)
43+
issues <- rm_data_issues_from_gh_api (path)
4444
index <- grep ("bug|defect|fix", issues$label, ignore.case = TRUE)
4545
index <- index [which (!grepl ("wontfix", issues$label [index]))]
4646
bugs <- issues [index, ]
@@ -113,7 +113,7 @@ cm_metric_pr_closure_ratio <- function (path, end_date = Sys.Date ()) {
113113
# suppress no visible binding notes:
114114
closed <- NULL
115115

116-
prs <- cm_data_prs_from_gh_api (path)
116+
prs <- rm_data_prs_from_gh_api (path)
117117
prs$created_at <- as.Date (prs$created_at)
118118
prs$closed_at <- as.Date (prs$closed_at)
119119

@@ -136,7 +136,7 @@ cm_metric_issue_age <- function (path, end_date = Sys.Date ()) {
136136

137137
start_date <- end_date - get_repometrics_period ()
138138

139-
issues <- cm_data_issues_from_gh_api (path) |>
139+
issues <- rm_data_issues_from_gh_api (path) |>
140140
dplyr::mutate (
141141
created_at = as.Date (created_at), closed_at = as.Date (closed_at)
142142
) |>

R/cm-data-dependencies.R R/data-dependencies.R

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#'
33
#' @param path Local path to repository
44
#' @noRd
5-
cm_data_dependencies <- function (path) {
5+
rm_data_dependencies <- function (path) {
66

77
desc_path <- fs::dir_ls (path, type = "file", regexp = "DESCRIPTION$")
88
checkmate::assert_file_exists (desc_path)
@@ -32,7 +32,7 @@ cm_data_dependencies <- function (path) {
3232
#'
3333
#' Note that this all works even for packages which aren't on CRAN.
3434
#' @noRd
35-
cm_data_dependencies_downstream <- function (path) {
35+
rm_data_dependencies_downstream <- function (path) {
3636

3737
cran_db <- cran_pkg_db ()
3838
pkg_name <- pkg_name_from_path (path)
@@ -52,16 +52,16 @@ cm_data_dependencies_downstream <- function (path) {
5252
#'
5353
#' @param path Local path to repository
5454
#' @noRd
55-
cm_data_libyears <- function (path) {
55+
rm_data_libyears <- function (path) {
5656

57-
deps <- cm_data_dependencies (path)
57+
deps <- rm_data_dependencies (path)
5858
cran_db <- data.frame (cran_pkg_db ())
5959
index <- match (deps$name, cran_db$Package)
6060
deps$cran_version <- cran_db$Version [index]
6161
deps$published <- as.Date (cran_db$Published [index])
6262
deps <- deps [which (!is.na (deps$published)), ]
6363

64-
rel <- cm_data_releases_from_gh_api (path, latest_only = TRUE)
64+
rel <- rm_data_releases_from_gh_api (path, latest_only = TRUE)
6565
rel_date <- as.Date (strftime (rel$published_at, format = "%Y-%m-%d"))
6666

6767
dt <- difftime (deps$published, rel_date, units = "days")

R/cm-data-gh-contribs.R R/data-gh-contribs.R

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#'
33
#' @param path Local path to repository
44
#' @noRd
5-
cm_data_contribs_from_log <- function (path) {
5+
rm_data_contribs_from_log <- function (path) {
66

7-
log <- cm_data_gitlog (path)
7+
log <- rm_data_gitlog (path)
88

99
gh_handle <- unique (log$aut_name)
1010
gh_email <- log$aut_email [match (gh_handle, log$aut_name)]
@@ -40,7 +40,7 @@ cm_data_contribs_from_log <- function (path) {
4040
#' @param n_per_page Not used here, but needed so all functions can safely be
4141
#' called with this parameter.
4242
#' @noRd
43-
cm_data_contribs_from_gh_api_internal <- function (path, n_per_page = 100L) {
43+
rm_data_contribs_from_gh_api_internal <- function (path, n_per_page = 100L) {
4444

4545
is_test_env <- Sys.getenv ("REPOMETRICS_TESTS") == "true"
4646
n_per_page <- n_per_page_in_tests (n_per_page)
@@ -94,8 +94,8 @@ cm_data_contribs_from_gh_api_internal <- function (path, n_per_page = 100L) {
9494

9595
return (ctbs)
9696
}
97-
cm_data_contribs_from_gh_api <-
98-
memoise::memoise (cm_data_contribs_from_gh_api_internal)
97+
rm_data_contribs_from_gh_api <-
98+
memoise::memoise (rm_data_contribs_from_gh_api_internal)
9999

100100
user_from_gh_api <- function (user) {
101101

@@ -134,9 +134,9 @@ main_contributors <- function (path, end_date = Sys.Date (), threshold = 0.9, pe
134134
checkmate::assert_integerish (period, min = 1L)
135135
log <- git_log_in_period (path, end_date = end_date, period = period)
136136
} else {
137-
log <- cm_data_gitlog (path)
137+
log <- rm_data_gitlog (path)
138138
}
139-
contribs <- cm_data_contribs_from_gh_api (path)
139+
contribs <- rm_data_contribs_from_gh_api (path)
140140

141141
index <- match (log$aut_email, contribs$email)
142142
log$login <- contribs$login [index]

R/cm-data-gh-forks.R R/data-gh-forks.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ gh_forks_qry <- function (org = "ropensci-review-tools",
2929
return (q)
3030
}
3131

32-
cm_data_repo_forks_internal <- function (path, n_per_page = 100L) {
32+
rm_data_repo_forks_internal <- function (path, n_per_page = 100L) {
3333

3434
is_test_env <- Sys.getenv ("REPOMETRICS_TESTS") == "true"
3535
n_per_page <- n_per_page_in_tests (n_per_page)
@@ -65,4 +65,4 @@ cm_data_repo_forks_internal <- function (path, n_per_page = 100L) {
6565
created = as.Date (created)
6666
)
6767
}
68-
cm_data_repo_forks <- memoise::memoise (cm_data_repo_forks_internal)
68+
rm_data_repo_forks <- memoise::memoise (rm_data_repo_forks_internal)

R/cm-data-gh-issues.R R/data-gh-issues.R

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cm_data_issues_from_gh_api_internal <- function (path, n_per_page = 100) {
1+
rm_data_issues_from_gh_api_internal <- function (path, n_per_page = 100) {
22

33
is_test_env <- Sys.getenv ("REPOMETRICS_TESTS") == "true"
44
n_per_page <- n_per_page_in_tests (n_per_page)
@@ -75,8 +75,8 @@ cm_data_issues_from_gh_api_internal <- function (path, n_per_page = 100) {
7575

7676
return (issues)
7777
}
78-
cm_data_issues_from_gh_api <-
79-
memoise::memoise (cm_data_issues_from_gh_api_internal)
78+
rm_data_issues_from_gh_api <-
79+
memoise::memoise (rm_data_issues_from_gh_api_internal)
8080

8181
get_issue_reactions <- function (body) {
8282

@@ -95,7 +95,7 @@ get_issue_reactions <- function (body) {
9595
return (reaction_counts)
9696
}
9797

98-
cm_data_issue_comments_from_gh_api_internal <- function (path,
98+
rm_data_issue_comments_from_gh_api_internal <- function (path,
9999
n_per_page = 100) {
100100

101101
is_test_env <- Sys.getenv ("REPOMETRICS_TESTS") == "true"
@@ -148,5 +148,5 @@ cm_data_issue_comments_from_gh_api_internal <- function (path,
148148
issue_body = issue_body
149149
)
150150
}
151-
cm_data_issue_comments_from_gh_api <-
152-
memoise::memoise (cm_data_issue_comments_from_gh_api_internal)
151+
rm_data_issue_comments_from_gh_api <-
152+
memoise::memoise (rm_data_issue_comments_from_gh_api_internal)

R/cm-data-gh-prs.R R/data-gh-prs.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ gh_prs_qry <- function (org = "ropensci-review-tools",
108108
return (q)
109109
}
110110

111-
cm_data_prs_from_gh_api_internal <- function (path, n_per_page = 30L) {
111+
rm_data_prs_from_gh_api_internal <- function (path, n_per_page = 30L) {
112112

113113
is_test_env <- Sys.getenv ("REPOMETRICS_TESTS") == "true"
114114
n_per_page <- n_per_page_in_tests (n_per_page)
@@ -273,4 +273,4 @@ cm_data_prs_from_gh_api_internal <- function (path, n_per_page = 30L) {
273273
reviews = I (reviews)
274274
)
275275
}
276-
cm_data_prs_from_gh_api <- memoise::memoise (cm_data_prs_from_gh_api_internal)
276+
rm_data_prs_from_gh_api <- memoise::memoise (rm_data_prs_from_gh_api_internal)

R/cm-data-gh-releases.R R/data-gh-releases.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cm_data_releases_from_gh_api_internal <- function (path,
1+
rm_data_releases_from_gh_api_internal <- function (path,
22
n_per_page = 100L,
33
latest_only = FALSE) {
44

@@ -53,5 +53,5 @@ cm_data_releases_from_gh_api_internal <- function (path,
5353
vapply (body, function (i) i$published_at, character (1L))
5454
)
5555
}
56-
cm_data_releases_from_gh_api <-
57-
memoise::memoise (cm_data_releases_from_gh_api_internal)
56+
rm_data_releases_from_gh_api <-
57+
memoise::memoise (rm_data_releases_from_gh_api_internal)

R/cm-data-gh-repo.R R/data-gh-repo.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#'
33
#' @param path Local path to repository
44
#' @noRd
5-
cm_data_repo_from_gh_api_internal <- function (path) {
5+
rm_data_repo_from_gh_api_internal <- function (path) {
66

77
or <- org_repo_from_path (path)
88

@@ -40,4 +40,4 @@ cm_data_repo_from_gh_api_internal <- function (path) {
4040
default_branch = null2na_char (body$default_branch)
4141
)
4242
}
43-
cm_data_repo_from_gh_api <- memoise::memoise (cm_data_repo_from_gh_api_internal)
43+
rm_data_repo_from_gh_api <- memoise::memoise (rm_data_repo_from_gh_api_internal)

R/cm-data-gh-stargazers.R R/data-gh-stargazers.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ gh_stargazers_qry <- function (org = "ropensci-review-tools",
3030
return (q)
3131
}
3232

33-
cm_data_repo_stargazers_internal <- function (path, n_per_page = 100L) {
33+
rm_data_repo_stargazers_internal <- function (path, n_per_page = 100L) {
3434

3535
is_test_env <- Sys.getenv ("REPOMETRICS_TESTS") == "true"
3636
n_per_page <- n_per_page_in_tests (n_per_page)
@@ -66,4 +66,4 @@ cm_data_repo_stargazers_internal <- function (path, n_per_page = 100L) {
6666
starred_at = as.Date (starred_at)
6767
)
6868
}
69-
cm_data_repo_stargazers <- memoise::memoise (cm_data_repo_stargazers_internal)
69+
rm_data_repo_stargazers <- memoise::memoise (rm_data_repo_stargazers_internal)

0 commit comments

Comments
 (0)