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
187187match_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
217218get_current_contribs <- function (filename , orgrepo ) {
219+
218220 x <- readLines (filename )
219221
220222 ghurl <- paste0 (
0 commit comments