Skip to content

Commit ed79b2c

Browse files
committed
tidy add-contribs.R & extend descr of new repo param from #35
1 parent 864d832 commit ed79b2c

4 files changed

Lines changed: 14 additions & 11 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: allcontributors
22
Title: Acknowledge all Contributors to a Project
3-
Version: 0.1.1.016
3+
Version: 0.1.1.017
44
Authors@R:
55
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre"))
66
Description: Acknowledge all contributors to a project via a single

R/add-contributors.R

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
#' Add contributors to README.Rmd
44
#'
55
#' @param repo Vector of repository locations for which contributions are to be
6-
#' extracted. Each location must be a git project with a github remote.
6+
#' extracted. Each location must be a git project with a github remote. Default
7+
#' is single repository in current working directory.
78
#' @param ncols Number of columns for contributors in 'README'
89
#' @param files Names of files in which to add contributors
910
#' @param type Type of contributions to include: 'code' for direct code
@@ -85,8 +86,10 @@ add_contributors <- function (repo = ".",
8586
alphabetical = FALSE,
8687
open_issue = FALSE,
8788
force_update = FALSE) {
89+
8890
all_repos <- do.call (rbind, lapply (repo, function (rep) {
89-
one_repo <- get_contributors_one_repo (
91+
92+
get_contributors_one_repo (
9093
repo = rep,
9194
type = type,
9295
exclude_label = exclude_label,
@@ -99,7 +102,6 @@ add_contributors <- function (repo = ".",
99102
alphabetical = alphabetical
100103
)
101104

102-
return (one_repo)
103105
}))
104106

105107
combined_df <- do.call (rbind, all_repos [, "ctbs"])
@@ -126,15 +128,13 @@ get_contributors_one_repo <- function (repo,
126128
format,
127129
check_urls,
128130
alphabetical) {
131+
129132
if (!in_git_repository (repo)) {
130133
stop ("The path [", repo, "] does not appear to be a git repository")
131134
}
132135

133-
if (identical (
134-
section_names,
135-
c ("Code", "Issue Authors", "Issue Contributors")
136-
) &&
137-
num_sections < 3) {
136+
sec_names_expected <- c ("Code", "Issue Authors", "Issue Contributors")
137+
if (identical (section_names, sec_names_expected) && num_sections < 3) {
138138

139139
if (num_sections == 1) {
140140
section_names <- rep ("", 3)
@@ -185,6 +185,7 @@ get_contributors_one_repo <- function (repo,
185185
}
186186

187187
match_type_arg <- function (type) {
188+
188189
if (length (type) > 3) {
189190
stop (paste0 (
190191
"There are only three possible types: ",
@@ -215,6 +216,7 @@ get_org_repo <- function (repo) {
215216

216217
# strip current list of contributors from filename
217218
get_current_contribs <- function (filename, orgrepo) {
219+
218220
x <- readLines (filename)
219221

220222
ghurl <- paste0 (

codemeta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"codeRepository": "https://github.com/ropenscilabs/allcontributors",
88
"issueTracker": "https://github.com/ropenscilabs/allcontributors/issues",
99
"license": "https://spdx.org/licenses/GPL-3.0",
10-
"version": "0.1.1.016",
10+
"version": "0.1.1.017",
1111
"programmingLanguage": {
1212
"@type": "ComputerLanguage",
1313
"name": "R",

man/add_contributors.Rd

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)