Skip to content

Commit f794010

Browse files
committed
use check_dots_empty
1 parent 089e2d9 commit f794010

7 files changed

+107
-55
lines changed

Diff for: R/alignpatch-inset.R

+12-7
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ ggplot_add.patch_inset <- function(object, plot, object_name) {
8282
#' @export
8383
#' @keywords internal
8484
patch <- function(x, ...) {
85-
rlang::check_dots_used()
8685
UseMethod("patch")
8786
}
8887

@@ -98,12 +97,14 @@ patch.default <- function(x, ...) {
9897
#' @family patch methods
9998
#' @export
10099
patch.grob <- function(x, ...) {
100+
rlang::check_dots_empty()
101101
x
102102
}
103103

104104
#' @export
105105
#' @rdname patch.grob
106106
patch.gList <- function(x, ...) {
107+
rlang::check_dots_empty()
107108
# gLists need to be wrapped in a grob tree
108109
grid::grobTree(x)
109110
}
@@ -114,7 +115,7 @@ patch.gList <- function(x, ...) {
114115
#' @family patch methods
115116
#' @export
116117
patch.ggplot <- function(x, ...) {
117-
ggplotGrob(x)
118+
ggplotGrob(x, ...)
118119
}
119120

120121
#' @inherit patch.grob
@@ -125,15 +126,15 @@ patch.ggplot <- function(x, ...) {
125126
#' @family patch methods
126127
#' @export
127128
patch.patch_ggplot <- function(x, ...) {
128-
ggalignGrob(x)
129+
ggalignGrob(x, ...)
129130
}
130131

131132
#' @inherit patch.grob
132133
#' @seealso [`alignpatches`][align_plots]
133134
#' @family patch methods
134135
#' @export
135136
patch.alignpatches <- function(x, ...) {
136-
ggalignGrob(x)
137+
ggalignGrob(x, ...)
137138
}
138139

139140
#' @inherit patch.grob
@@ -142,7 +143,7 @@ patch.alignpatches <- function(x, ...) {
142143
#' @export
143144
patch.patchwork <- function(x, ...) {
144145
rlang::check_installed("patchwork", "to make grob from patchwork")
145-
patchwork::patchworkGrob(x)
146+
patchwork::patchworkGrob(x, ...)
146147
}
147148

148149
#' @inherit patch.grob
@@ -151,7 +152,7 @@ patch.patchwork <- function(x, ...) {
151152
#' @export
152153
patch.patch <- function(x, ...) {
153154
rlang::check_installed("patchwork", "to make grob from patch")
154-
patchwork::patchGrob(x)
155+
patchwork::patchGrob(x, ...)
155156
}
156157

157158
#' @inherit patch.grob
@@ -201,6 +202,7 @@ patch.function <- function(x, ..., device = NULL, name = NULL) {
201202
#' @export
202203
patch.recordedplot <- function(x, ..., device = NULL) {
203204
rlang::check_installed("gridGraphics", "to make grob from recordedplot")
205+
rlang::check_dots_empty()
204206
gridGraphics::echoGrob(x, device = device %||% offscreen)
205207
}
206208

@@ -257,4 +259,7 @@ patch.HeatmapAnnotation <- patch.HeatmapList
257259
#' @seealso [`pheatmap()`][pheatmap::pheatmap]
258260
#' @family patch methods
259261
#' @export
260-
patch.pheatmap <- function(x, ...) .subset2(x, "gtable")
262+
patch.pheatmap <- function(x, ...) {
263+
rlang::check_dots_empty()
264+
.subset2(x, "gtable")
265+
}

Diff for: R/fortify-upset.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#' @export
2121
fortify_upset <- function(data, mode = "distinct", ...) {
2222
mode <- arg_match0(mode, c("distinct", "intersect", "union"))
23-
rlang::check_dots_used()
2423
UseMethod("fortify_upset")
2524
}
2625

@@ -34,6 +33,7 @@ fortify_upset <- function(data, mode = "distinct", ...) {
3433
#' @family fortify_upset methods
3534
#' @export
3635
fortify_upset.list <- function(data, mode = "distinct", ...) {
36+
rlang::check_dots_empty()
3737
data <- lapply(data, function(x) {
3838
vec_unique(vec_slice(x, !vec_detect_missing(x)))
3939
})

Diff for: R/ggfree.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#' geom_point()
3232
#' @export
3333
ggfree <- function(data = waiver(), ..., size = NULL, active = NULL) {
34-
rlang::check_dots_used()
3534
UseMethod("ggfree", data)
3635
}
3736

@@ -60,6 +59,7 @@ ggfree.uneval <- function(data = waiver(), ...) {
6059

6160
#' @export
6261
ggfree.ggplot <- function(data = waiver(), ..., size = NULL, active = NULL) {
62+
rlang::check_dots_empty()
6363
plot <- data
6464
# In ggplot2, `waiver()` was regard to no data
6565
data <- .subset2(plot, "data") %|w|% NULL

Diff for: R/layout-.R

+4-2
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ inherit_parent_layout_theme <- function(layout, theme, spacing = NULL) {
122122
#' @return The statistics
123123
#' @export
124124
ggalign_stat <- function(x, ...) {
125-
rlang::check_dots_used()
126125
UseMethod("ggalign_stat")
127126
}
128127

@@ -154,7 +153,10 @@ ggalign_stat.ggalign_plot <- function(x, ...) {
154153
}
155154

156155
#' @export
157-
ggalign_stat.Align <- function(x, ...) .subset2(x, "statistics")
156+
ggalign_stat.Align <- function(x, ...) {
157+
rlang::check_dots_empty()
158+
.subset2(x, "statistics")
159+
}
158160

159161
#' @export
160162
ggalign_stat.default <- function(x, ...) {

Diff for: R/raster-magick.R

+26-14
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ raster_magick <- function(x, magick = NULL, ...,
4646
}
4747
assert_number_whole(res, min = 1, allow_null = TRUE)
4848
assert_bool(interpolate)
49-
rlang::check_dots_used()
5049
.raster_magick(
5150
x = x, ..., magick = magick,
5251
res = res, interpolate = interpolate
@@ -61,16 +60,20 @@ raster_magick <- function(x, magick = NULL, ...,
6160
#' `raster_magick()`. It assumes the input arguments are valid and does not
6261
#' perform any additional checks.
6362
#' @inheritParams raster_magick
63+
#' @name raster_magick_interal
6464
#' @keywords internal
65-
.raster_magick <- function(x, magick = NULL, ...) {
65+
.raster_magick <- function(x, ...) {
6666
UseMethod(".raster_magick")
6767
}
6868

6969
#' @importFrom ggplot2 ggproto ggproto_parent
70+
#' @importFrom rlang list2
7071
#' @export
71-
.raster_magick.Layer <- function(x, magick = NULL, ...) {
72+
#' @rdname raster_magick_interal
73+
.raster_magick.Layer <- function(x, ...) {
7274
ggproto(
7375
NULL, x,
76+
.ggalign_raster_magick = list2(...),
7477
draw_geom = function(self, data, layout) {
7578
grobs <- ggproto_parent(x, self)$draw_geom(data, layout)
7679
if (!inherits(layout$coord, "CoordCartesian")) {
@@ -79,26 +82,30 @@ raster_magick <- function(x, magick = NULL, ...,
7982
)
8083
return(grobs)
8184
}
82-
lapply(grobs, .raster_magick, ..., magick = magick)
85+
inject(.raster_magick(grobs, !!!self$.ggalign_raster_magick))
8386
}
8487
)
8588
}
8689

8790
#' @export
88-
.raster_magick.list <- function(x, magick = NULL, ...) {
89-
lapply(x, .raster_magick, ..., magick = magick)
91+
#' @rdname raster_magick_interal
92+
.raster_magick.list <- function(x, ...) {
93+
lapply(x, .raster_magick, ...)
9094
}
9195

9296
#' @export
93-
.raster_magick.ggplot <- function(x, magick = NULL, ...) {
94-
x$layers <- lapply(x$layers, .raster_magick, ..., magick = magick)
97+
#' @rdname raster_magick_interal
98+
.raster_magick.ggplot <- function(x, ...) {
99+
x$layers <- lapply(x$layers, .raster_magick, ...)
95100
x
96101
}
97102

98103
#' @importFrom grid grob
99104
#' @export
105+
#' @rdname raster_magick_interal
100106
.raster_magick.grob <- function(x, magick = NULL, ...,
101107
res = NULL, interpolate = FALSE) {
108+
rlang::check_dots_empty()
102109
grob(
103110
grob = x,
104111
magick = magick,
@@ -110,23 +117,28 @@ raster_magick <- function(x, magick = NULL, ...,
110117

111118
#' @importFrom grid grob
112119
#' @export
120+
#' @rdname raster_magick_interal
113121
.raster_magick.gList <- .raster_magick.grob
114122

123+
#' @importFrom grid editGrob
115124
#' @export
125+
#' @rdname raster_magick_interal
116126
.raster_magick.ggalignRasterMagick <- function(x, magick = NULL, ...,
117127
res = NULL,
118128
interpolate = FALSE) {
119-
x["magick"] <- list(magick)
120-
x["res"] <- list(res)
121-
x["interpolate"] <- list(interpolate)
122-
x
129+
rlang::check_dots_empty()
130+
editGrob(x, magick = magick, res = res, interpolate = interpolate)
123131
}
124132

133+
# there methods won't check arguments, all arguments passed will be just ignored
134+
# directly
125135
#' @export
126-
.raster_magick.zeroGrob <- function(x, magick = NULL, ...) x
136+
#' @rdname raster_magick_interal
137+
.raster_magick.zeroGrob <- function(x, ...) x
127138

128139
#' @export
129-
.raster_magick.default <- function(x, magick = NULL, ...) x
140+
#' @rdname raster_magick_interal
141+
.raster_magick.default <- function(x, ...) x
130142

131143
# preDraw:
132144
# - makeContext

Diff for: man/dot-raster_magick.Rd

-30
This file was deleted.

Diff for: man/raster_magick_interal.Rd

+63
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)