Skip to content

Commit 4b18e02

Browse files
authored
Merge pull request #92 from ropensci-review-tools/no-aut
fix 'get_desc_authors' when no aut specified
2 parents 7a936b2 + 0952edf commit 4b18e02

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
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.5.020
3+
Version: 0.1.5.023
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-metric-maintainer-count.R

+14-6
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,17 @@ match_repo_ctbs_to_desc <- function (path, desc_auts, gh_auts) {
7575
match_string_vecs (desc_auts$name, ctbs_from_gh$name),
7676
match_string_vecs (desc_auts$email, ctbs_from_gh$email)
7777
)
78-
n_from_log <- apply (index_from_log, 1, function (i) any (!is.na (i))) |>
79-
which () |>
80-
length ()
81-
n_from_gh <- apply (index_from_gh, 1, function (i) any (!is.na (i))) |>
82-
which () |>
83-
length ()
78+
n_from_log <- n_from_gh <- 0L
79+
if (length (index_from_log) > 0L) {
80+
n_from_log <- apply (index_from_log, 1, function (i) any (!is.na (i))) |>
81+
which () |>
82+
length ()
83+
}
84+
if (length (index_from_gh) > 0L) {
85+
n_from_gh <- apply (index_from_gh, 1, function (i) any (!is.na (i))) |>
86+
which () |>
87+
length ()
88+
}
8489

8590
return (max (c (n_from_log, n_from_gh)))
8691
}
@@ -114,6 +119,9 @@ get_desc_authors <- function (path, roles = c ("cre", "aut")) {
114119
if (any (grepl ("<", auts))) {
115120
aut_emails <- gsub ("^.*<|>(\\s?)$", "", auts)
116121
}
122+
if (length (aut_names) == 0L || length (aut_emails) == 0L) {
123+
aut_names <- aut_emails <- character (0L)
124+
}
117125

118126
data.frame (name = aut_names, email = aut_emails)
119127
}

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.5.020",
11+
"version": "0.1.5.023",
1212
"programmingLanguage": {
1313
"@type": "ComputerLanguage",
1414
"name": "R",

tests/testthat/_snaps/cm-metrics.md

-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22

33
Code
44
chk <- cm_metric_has_ci(path)
5-
Message
6-
i Unable to determine whether runs are recent for CI service [github].
75

0 commit comments

Comments
 (0)