Skip to content

Commit

Permalink
tidy add-contribs.R & extend descr of new repo param from #35
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed May 15, 2024
1 parent 864d832 commit ed79b2c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: allcontributors
Title: Acknowledge all Contributors to a Project
Version: 0.1.1.016
Version: 0.1.1.017
Authors@R:
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre"))
Description: Acknowledge all contributors to a project via a single
Expand Down
18 changes: 10 additions & 8 deletions R/add-contributors.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#' Add contributors to README.Rmd
#'
#' @param repo Vector of repository locations for which contributions are to be
#' extracted. Each location must be a git project with a github remote.
#' extracted. Each location must be a git project with a github remote. Default
#' is single repository in current working directory.
#' @param ncols Number of columns for contributors in 'README'
#' @param files Names of files in which to add contributors
#' @param type Type of contributions to include: 'code' for direct code
Expand Down Expand Up @@ -85,8 +86,10 @@ add_contributors <- function (repo = ".",
alphabetical = FALSE,
open_issue = FALSE,
force_update = FALSE) {

all_repos <- do.call (rbind, lapply (repo, function (rep) {
one_repo <- get_contributors_one_repo (

get_contributors_one_repo (
repo = rep,
type = type,
exclude_label = exclude_label,
Expand All @@ -99,7 +102,6 @@ add_contributors <- function (repo = ".",
alphabetical = alphabetical
)

return (one_repo)
}))

combined_df <- do.call (rbind, all_repos [, "ctbs"])
Expand All @@ -126,15 +128,13 @@ get_contributors_one_repo <- function (repo,
format,
check_urls,
alphabetical) {

if (!in_git_repository (repo)) {
stop ("The path [", repo, "] does not appear to be a git repository")
}

if (identical (
section_names,
c ("Code", "Issue Authors", "Issue Contributors")
) &&
num_sections < 3) {
sec_names_expected <- c ("Code", "Issue Authors", "Issue Contributors")
if (identical (section_names, sec_names_expected) && num_sections < 3) {

if (num_sections == 1) {
section_names <- rep ("", 3)
Expand Down Expand Up @@ -185,6 +185,7 @@ get_contributors_one_repo <- function (repo,
}

match_type_arg <- function (type) {

if (length (type) > 3) {
stop (paste0 (
"There are only three possible types: ",
Expand Down Expand Up @@ -215,6 +216,7 @@ get_org_repo <- function (repo) {

# strip current list of contributors from filename
get_current_contribs <- function (filename, orgrepo) {

x <- readLines (filename)

ghurl <- paste0 (
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"codeRepository": "https://github.com/ropenscilabs/allcontributors",
"issueTracker": "https://github.com/ropenscilabs/allcontributors/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.1.1.016",
"version": "0.1.1.017",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
3 changes: 2 additions & 1 deletion man/add_contributors.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ed79b2c

Please sign in to comment.