Skip to content

Commit

Permalink
Require contact details in CoC (r-lib#1374)
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley authored Feb 25, 2021
1 parent 158c2e5 commit 012dac5
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 12 deletions.
10 changes: 4 additions & 6 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ representative at an online or offline event.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at [INSERT CONTACT
METHOD]. All complaints will be reviewed and investigated promptly and fairly.
reported to the community leaders responsible for enforcement at [email protected].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
Expand Down Expand Up @@ -115,14 +115,12 @@ community.

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0,
available at https://www.contributor-covenant.org/version/2/0/
code_of_conduct.html.
available at <https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at https://
www.contributor-covenant.org/translations.
<https://www.contributor-covenant.org/faq>. Translations are available at <https://www.contributor-covenant.org/translations>.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# usethis (development version)

* `use_code_of_conduct()` now requires a `contact` argument to supply contact
details for reporting CoC violations (#1269).

* We no longer suggest including your test environments in `cran-comments.md`,
since there's no evidence that CRAN finds it useful, and it's annoying to
keep up to date (#1365).
Expand Down
9 changes: 8 additions & 1 deletion R/code-of-conduct.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@
#' `url` field in `_pkgdown.yml`; otherwise it will link to a copy of the CoC
#' on <https://www.contributor-covenant.org>.
#'
#' @param contact Contact details for making a code of conduct report.
#' Usually an email address.
#' @param path Path of the directory to put `CODE_OF_CONDUCT.md` in, relative to
#' the active project. Passed along to [use_directory()]. Default is to locate
#' at top-level, but `.github/` is also common.
#'
#' @export
use_code_of_conduct <- function(path = NULL) {
use_code_of_conduct <- function(contact, path = NULL) {
if (missing(contact)) {
abort("`use_code_of_conduct()` requires contact details in first argument")
}

if (!is.null(path)) {
use_directory(path, ignore = is_package())
}
Expand All @@ -28,6 +34,7 @@ use_code_of_conduct <- function(path = NULL) {
new <- use_template(
"CODE_OF_CONDUCT.md",
save_as = save_as,
data = list(contact = contact),
ignore = is_package() && is.null(path)
)

Expand Down
2 changes: 1 addition & 1 deletion R/tidyverse.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ use_tidy_issue_template <- function() {
#' @rdname tidyverse
use_tidy_coc <- function() {
use_dot_github()
use_code_of_conduct(path = ".github")
use_code_of_conduct("[email protected]", path = ".github")
}

#' @export
Expand Down
4 changes: 2 additions & 2 deletions inst/templates/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ representative at an online or offline event.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at [INSERT CONTACT
METHOD]. All complaints will be reviewed and investigated promptly and fairly.
reported to the community leaders responsible for enforcement at {{{ contact }}}.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
Expand Down
5 changes: 4 additions & 1 deletion man/use_code_of_conduct.Rd

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

2 changes: 1 addition & 1 deletion tests/testthat/test-code-of-conduct.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test_that("use_code_of_conduct() creates promised file", {
create_local_project()
use_code_of_conduct()
use_code_of_conduct("[email protected]")
expect_proj_file("CODE_OF_CONDUCT.md")
})

0 comments on commit 012dac5

Please sign in to comment.