Skip to content

Commit 020e852

Browse files
authored
Update infrastructure to new best practices (tidyverse#4748)
1 parent 6456003 commit 020e852

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+351
-203
lines changed

.github/CODE_OF_CONDUCT.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at [email protected].
63+
All complaints will be reviewed and investigated promptly and fairly.
64+
65+
All community leaders are obligated to respect the privacy and security of the
66+
reporter of any incident.
67+
68+
## Enforcement Guidelines
69+
70+
Community leaders will follow these Community Impact Guidelines in determining
71+
the consequences for any action they deem in violation of this Code of Conduct:
72+
73+
### 1. Correction
74+
75+
**Community Impact**: Use of inappropriate language or other behavior deemed
76+
unprofessional or unwelcome in the community.
77+
78+
**Consequence**: A private, written warning from community leaders, providing
79+
clarity around the nature of the violation and an explanation of why the
80+
behavior was inappropriate. A public apology may be requested.
81+
82+
### 2. Warning
83+
84+
**Community Impact**: A violation through a single incident or series of
85+
actions.
86+
87+
**Consequence**: A warning with consequences for continued behavior. No
88+
interaction with the people involved, including unsolicited interaction with
89+
those enforcing the Code of Conduct, for a specified period of time. This
90+
includes avoiding interactions in community spaces as well as external channels
91+
like social media. Violating these terms may lead to a temporary or permanent
92+
ban.
93+
94+
### 3. Temporary Ban
95+
96+
**Community Impact**: A serious violation of community standards, including
97+
sustained inappropriate behavior.
98+
99+
**Consequence**: A temporary ban from any sort of interaction or public
100+
communication with the community for a specified period of time. No public or
101+
private interaction with the people involved, including unsolicited interaction
102+
with those enforcing the Code of Conduct, is allowed during this period.
103+
Violating these terms may lead to a permanent ban.
104+
105+
### 4. Permanent Ban
106+
107+
**Community Impact**: Demonstrating a pattern of violation of community
108+
standards, including sustained inappropriate behavior, harassment of an
109+
individual, or aggression toward or disparagement of classes of individuals.
110+
111+
**Consequence**: A permanent ban from any sort of public interaction within the
112+
community.
113+
114+
## Attribution
115+
116+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117+
version 2.1, available at
118+
<https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>.
119+
120+
Community Impact Guidelines were inspired by
121+
[Mozilla's code of conduct enforcement ladder][https://github.com/mozilla/inclusion].
122+
123+
For answers to common questions about this code of conduct, see the FAQ at
124+
<https://www.contributor-covenant.org/faq>. Translations are available at <https://www.contributor-covenant.org/translations>.
125+
126+
[homepage]: https://www.contributor-covenant.org

CODE_OF_CONDUCT.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

DESCRIPTION

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ BugReports: https://github.com/tidyverse/ggplot2/issues
3030
Depends:
3131
R (>= 3.3)
3232
Imports:
33+
cli,
3334
digest,
3435
glue,
3536
grDevices,
3637
grid,
3738
gtable (>= 0.1.1),
3839
isoband,
40+
lifecycle,
3941
MASS,
4042
mgcv,
4143
rlang (>= 0.4.10),
@@ -79,7 +81,7 @@ Config/testthat/edition: 3
7981
Encoding: UTF-8
8082
LazyData: true
8183
Roxygen: list(markdown = TRUE)
82-
RoxygenNote: 7.1.1
84+
RoxygenNote: 7.1.2
8385
Collate:
8486
'ggproto.r'
8587
'ggplot-global.R'
@@ -168,7 +170,7 @@ Collate:
168170
'geom-tile.r'
169171
'geom-violin.r'
170172
'geom-vline.r'
171-
'ggplot2.r'
173+
'ggplot2-package.R'
172174
'grob-absolute.r'
173175
'grob-dotstack.r'
174176
'grob-null.r'

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,7 @@ import(rlang)
673673
import(scales)
674674
importFrom(glue,glue)
675675
importFrom(glue,glue_collapse)
676+
importFrom(lifecycle,deprecated)
676677
importFrom(stats,setNames)
677678
importFrom(tibble,tibble)
678679
importFrom(utils,.DollarNames)

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# ggplot2 (development version)
22

3+
* referring to `x` in backquoted expressions with `label_bquote()` is no longer
4+
possible.
5+
36
* `position_stack()` now works fully with `geom_text()` (@thomasp85, #4367)
47

58
* `geom_tile()` now correctly recognises missing data in `xmin`, `xmax`, `ymin`,

R/aes.r

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ is_position_aes <- function(vars) {
212212

213213
#' Define aesthetic mappings programmatically
214214
#'
215+
#' @description
216+
#' `r lifecycle::badge("deprecated")`
217+
#'
215218
#' Aesthetic mappings describe how variables in the data are mapped to visual
216219
#' properties (aesthetics) of geoms. [aes()] uses non-standard
217220
#' evaluation to capture the variable names. `aes_()` and `aes_string()`
@@ -239,6 +242,9 @@ is_position_aes <- function(vars) {
239242
#' @param x,y,... List of name value pairs. Elements must be either
240243
#' quoted calls, strings, one-sided formulas or constants.
241244
#' @seealso [aes()]
245+
#'
246+
#' @keywords internal
247+
#'
242248
#' @export
243249
#' @examples
244250
#' # Three ways of generating the same aesthetics
@@ -258,6 +264,11 @@ is_position_aes <- function(vars) {
258264
#' aes(col = x)
259265
#' aes_(col = as.name(var))
260266
aes_ <- function(x, y, ...) {
267+
lifecycle::deprecate_soft(
268+
"3.0.0",
269+
"aes_()",
270+
details = "Please use tidy evaluation ideoms with `aes()`"
271+
)
261272
mapping <- list(...)
262273
if (!missing(x)) mapping["x"] <- list(x)
263274
if (!missing(y)) mapping["y"] <- list(y)
@@ -280,6 +291,11 @@ aes_ <- function(x, y, ...) {
280291
#' @rdname aes_
281292
#' @export
282293
aes_string <- function(x, y, ...) {
294+
lifecycle::deprecate_soft(
295+
"3.0.0",
296+
"aes_string()",
297+
details = "Please use tidy evaluation ideoms with `aes()`"
298+
)
283299
mapping <- list(...)
284300
if (!missing(x)) mapping["x"] <- list(x)
285301
if (!missing(y)) mapping["y"] <- list(y)
@@ -321,12 +337,15 @@ aes_all <- function(vars) {
321337

322338
#' Automatic aesthetic mapping
323339
#'
340+
#' @description
341+
#' `r lifecycle::badge("deprecated")`
342+
#'
324343
#' @param data data.frame or names of variables
325344
#' @param ... aesthetics that need to be explicitly mapped.
326345
#' @keywords internal
327346
#' @export
328347
aes_auto <- function(data = NULL, ...) {
329-
warn("aes_auto() is deprecated")
348+
lifecycle::deprecate_warn("2.0.0", "aes_auto()")
330349

331350
# detect names of data
332351
if (is.null(data)) {

R/backports.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ if (getRversion() < 3.3) {
1515
backport_unit_methods <- function() {}
1616
}
1717

18+
on_load(backport_unit_methods())
19+
1820
# isFALSE() is available on R (>=3.5)
1921
if (getRversion() < 3.5) {
2022
isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x

R/bin.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
bins <- function(breaks, closed = c("right", "left"),
1+
bins <- function(breaks, closed = "right",
22
fuzz = 1e-08 * stats::median(diff(breaks))) {
33
if (!is.numeric(breaks)) abort("`breaks` must be a numeric vector")
4-
closed <- match.arg(closed)
4+
closed <- arg_match0(closed, c("right", "left"))
55

66
breaks <- sort(breaks)
77
# Adapted base::hist - this protects from floating point rounding errors

R/compat-plyr.R

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,15 @@ rbind_dfs <- function(dfs) {
338338
)
339339
out
340340
}
341+
342+
# Info needed for rbind_dfs date/time handling
343+
on_load({
344+
date <- Sys.Date()
345+
ggplot_global$date_origin <- date - unclass(date)
346+
time <- Sys.time()
347+
ggplot_global$time_origin <- time - unclass(time)
348+
})
349+
341350
#' Apply function to unique subsets of a data.frame
342351
#'
343352
#' This function is akin to `plyr::ddply`. It takes a single data.frame,

R/coord-polar.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
#' }
6060
#' }
6161
coord_polar <- function(theta = "x", start = 0, direction = 1, clip = "on") {
62-
theta <- match.arg(theta, c("x", "y"))
62+
theta <- arg_match0(theta, c("x", "y"))
6363
r <- if (theta == "x") "y" else "x"
6464

6565
ggproto(NULL, CoordPolar,

R/coord-sf.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ coord_sf <- function(xlim = NULL, ylim = NULL, expand = TRUE,
656656
crs = NULL, default_crs = NULL,
657657
datum = sf::st_crs(4326),
658658
label_graticule = waiver(),
659-
label_axes = waiver(), lims_method = c("cross", "box", "orthogonal", "geometry_bbox"),
659+
label_axes = waiver(), lims_method = "cross",
660660
ndiscr = 100, default = FALSE, clip = "on") {
661661

662662
if (is.waive(label_graticule) && is.waive(label_axes)) {
@@ -688,7 +688,7 @@ coord_sf <- function(xlim = NULL, ylim = NULL, expand = TRUE,
688688
if (is.null(default_crs) && is_missing(lims_method)) {
689689
lims_method <- "orthogonal"
690690
} else {
691-
lims_method <- match.arg(lims_method)
691+
lims_method <- arg_match0(lims_method, c("cross", "box", "orthogonal", "geometry_bbox"))
692692
}
693693

694694
ggproto(NULL, CoordSf,

R/coord-transform.r

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#'
1111
#' @inheritParams coord_cartesian
1212
#' @param x,y Transformers for x and y axes or their names.
13-
#' @param limx,limy **Deprecated**: use `xlim` and `ylim` instead.
13+
#' @param limx,limy `r lifecycle::badge("deprecated")` use `xlim` and `ylim` instead.
1414
#' @export
1515
#' @examples
1616
#' \donttest{
@@ -75,13 +75,13 @@
7575
#' plot + coord_trans(x = "sqrt")
7676
#' }
7777
coord_trans <- function(x = "identity", y = "identity", xlim = NULL, ylim = NULL,
78-
limx = "DEPRECATED", limy = "DEPRECATED", clip = "on", expand = TRUE) {
79-
if (!missing(limx)) {
80-
warn("`limx` argument is deprecated; please use `xlim` instead.")
78+
limx = deprecated(), limy = deprecated(), clip = "on", expand = TRUE) {
79+
if (lifecycle::is_present(limx)) {
80+
lifecycle::deprecate_warn("3.3.0", "coord_trans(limx)", "coord_trans(xlim)")
8181
xlim <- limx
8282
}
83-
if (!missing(limy)) {
84-
warn("`limy` argument is deprecated; please use `ylim` instead.")
83+
if (lifecycle::is_present(limy)) {
84+
lifecycle::deprecate_warn("3.3.0", "coord_trans(limy)", "coord_trans(ylim)")
8585
ylim <- limy
8686
}
8787

R/facet-grid-.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ facet_grid <- function(rows = NULL, cols = NULL, scales = "fixed",
123123
cols <- NULL
124124
}
125125

126-
scales <- match.arg(scales, c("fixed", "free_x", "free_y", "free"))
126+
scales <- arg_match0(scales, c("fixed", "free_x", "free_y", "free"))
127127
free <- list(
128128
x = any(scales %in% c("free_x", "free")),
129129
y = any(scales %in% c("free_y", "free"))
130130
)
131131

132-
space <- match.arg(space, c("fixed", "free_x", "free_y", "free"))
132+
space <- arg_match0(space, c("fixed", "free_x", "free_y", "free"))
133133
space_free <- list(
134134
x = any(space %in% c("free_x", "free")),
135135
y = any(space %in% c("free_y", "free"))

R/facet-wrap.r

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ NULL
7979
#' }
8080
facet_wrap <- function(facets, nrow = NULL, ncol = NULL, scales = "fixed",
8181
shrink = TRUE, labeller = "label_value", as.table = TRUE,
82-
switch = NULL, drop = TRUE, dir = "h", strip.position = 'top') {
83-
scales <- match.arg(scales, c("fixed", "free_x", "free_y", "free"))
84-
dir <- match.arg(dir, c("h", "v"))
82+
switch = deprecated(), drop = TRUE, dir = "h",
83+
strip.position = 'top') {
84+
scales <- arg_match0(scales, c("fixed", "free_x", "free_y", "free"))
85+
dir <- arg_match0(dir, c("h", "v"))
8586
free <- list(
8687
x = any(scales %in% c("free_x", "free")),
8788
y = any(scales %in% c("free_y", "free"))
@@ -93,11 +94,11 @@ facet_wrap <- function(facets, nrow = NULL, ncol = NULL, scales = "fixed",
9394
# Flatten all facets dimensions into a single one
9495
facets <- wrap_as_facets_list(facets)
9596

96-
if (!is.null(switch)) {
97-
.Deprecated("strip.position", old = "switch")
97+
if (lifecycle::is_present(switch)) {
98+
lifecycle::deprecate_warn("2.2.0", "facet_wrap(switch)", "facet_wrap(strip.position)")
9899
strip.position <- if (switch == "x") "bottom" else "left"
99100
}
100-
strip.position <- match.arg(strip.position, c("top", "bottom", "left", "right"))
101+
strip.position <- arg_match0(strip.position, c("top", "bottom", "left", "right"))
101102
if (identical(dir, "v")) {
102103
# swap
103104
nrow_swap <- ncol

0 commit comments

Comments
 (0)