fix: 3 shinipsum issues — geom_line(size=) deprecation (#13), random_image args (#9), n_bars (#5)#15
Open
VincentGuyader wants to merge 3 commits into
Open
fix: 3 shinipsum issues — geom_line(size=) deprecation (#13), random_image args (#9), n_bars (#5)#15VincentGuyader wants to merge 3 commits into
VincentGuyader wants to merge 3 commits into
Conversation
…bars (#5) - #13: random_ggplot('line') was using geom_line(size=) which ggplot2 >= 3.4 deprecated in favour of linewidth=. Switch the call. Regression test builds a 'line' plot and asserts no lifecycle warning, plus a static sweep on Plot.R. - #9: random_image() now accepts width / height / alt and includes them in the returned list when set. Default shape unchanged (just src). - #5: random_ggplot('bar', n_bars = n) generates a synthetic categorical data frame so the rendered plot has *exactly* n bars. Without the argument, the legacy datasets-based behaviour is kept. Tracking notes in dev/SUIVI_ISSUES.md.
…drop brittle sweep)
- Drop withr::with_seed() in tests in favour of an inline
set.seed/.Random.seed save-restore: withr is not declared in the
package's DESCRIPTION, R CMD check NOTE'd '::' import not declared.
- Declare 'category' and 'value' in R/globals.R: random_ggplot('bar',
n_bars=) uses them in aes() and was raising 'no visible binding'.
- Drop the static-sweep test in test-no_deprecated_args.R: it tried to
read R/Plot.R from the source tree, which doesn't exist past
installation, so R CMD check tests errored. The first regression
test (build the plot, assert no lifecycle warning) is sufficient.
Pre-existing CI used actions/cache@v2 (now hard-failed by GitHub) and r-lib/actions setup-r@v1. Replace test-coverage and pkgdown with the standard r-lib/actions v2 templates on ubuntu-latest, bump R-CMD-check checkout v3 -> v5 (Node.js 24).
This was referenced May 12, 2026
There was a problem hiding this comment.
Pull request overview
This PR addresses three tracked shinipsum issues by updating ggplot generation to avoid a ggplot2 deprecation warning, extending random_image() to pass through common <img> attributes, and adding deterministic bar-count control for random_ggplot(type = "bar").
Changes:
- Add
n_barstorandom_ggplot()and generate synthetic categorical data when set. - Extend
random_image()with optionalwidth,height, andaltfields (while preserving the defaultlist(src=...)shape). - Add regression tests for the above, plus CI workflow modernizations and refreshed roxygen outputs.
Reviewed changes
Copilot reviewed 11 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/testthat/test-no_deprecated_args.R | Adds a test to ensure building a line plot doesn’t emit the ggplot2 size/linewidth deprecation warning. |
| tests/testthat/test-image_args.R | Adds tests verifying random_image() default return shape and optional argument propagation. |
| tests/testthat/test-bar_n.R | Adds tests ensuring n_bars yields exactly N bars and invalid inputs error. |
| R/Plot.R | Implements n_bars support and switches a line plot from size to linewidth. |
| R/Image.R | Adds width, height, alt arguments and includes them in the returned renderImage list when non-NULL. |
| R/globals.R | Registers new NSE column symbols used by the synthetic bar plot path. |
| man/shinipsum-package.Rd | Minor formatting update to the package description. |
| man/random_image.Rd | Documents new random_image() arguments/return value. |
| man/random_ggplot.Rd | Documents new n_bars argument. |
| dev/SUIVI_ISSUES.md | Adds internal tracking notes for issues #5/#9/#13. |
| DESCRIPTION | Updates RoxygenNote. |
| .github/workflows/test-coverage.yaml | Modernizes coverage workflow (r-lib/actions v2, ubuntu-latest, expanded branch triggers). |
| .github/workflows/R-CMD-check.yaml | Updates checkout action version. |
| .github/workflows/pkgdown.yaml | Modernizes pkgdown build/deploy workflow (r-lib/actions v2, deploy action). |
Files not reviewed (3)
- man/random_ggplot.Rd: Language not supported
- man/random_image.Rd: Language not supported
- man/shinipsum-package.Rd: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ggplot(datasets::women) + | ||
| aes(height, weight) + | ||
| geom_line(size = 2) + | ||
| geom_line(linewidth = 2) + |
Comment on lines
+48
to
+49
| stopifnot(is.numeric(n_bars), length(n_bars) == 1L, | ||
| !is.na(n_bars), n_bars >= 1L) |
| @@ -2,14 +2,25 @@ | |||
| #' | |||
| #' This function returns a random image that can be passed into `renderImage` and `plotOutput`. | |||
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 14 changed files in this pull request and generated 4 comments.
Files not reviewed (3)
- man/random_ggplot.Rd: Language not supported
- man/random_image.Rd: Language not supported
- man/shinipsum-package.Rd: Language not supported
Comment on lines
+47
to
+54
| if (type_matched == "bar" && !is.null(n_bars)) { | ||
| stopifnot(is.numeric(n_bars), length(n_bars) == 1L, | ||
| !is.na(n_bars), n_bars >= 1L) | ||
| n_bars <- as.integer(n_bars) | ||
| df <- data.frame( | ||
| category = factor(make_bar_labels(n_bars), | ||
| levels = make_bar_labels(n_bars)), | ||
| value = sample.int(100L, n_bars, replace = TRUE) |
| ggplot(datasets::women) + | ||
| aes(height, weight) + | ||
| geom_line(size = 2) + | ||
| geom_line(linewidth = 2) + |
Comment on lines
+22
to
+23
| msgs <- capture_warnings(invisible(ggplot2::ggplot_build(p))) | ||
| expect_false(any(grepl("size.*deprecated", msgs))) |
Comment on lines
+15
to
+20
| set.seed(42) | ||
| p <- random_ggplot("line") | ||
| # Building the plot is what triggers the lifecycle warning, not the | ||
| # construction. expect_no_warning() requires testthat 3.1.5+. | ||
| if (utils::packageVersion("testthat") >= "3.1.5") { | ||
| expect_no_warning(invisible(ggplot2::ggplot_build(p))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
random_ggplot("line")triggered ggplot2'ssize → linewidthdeprecation warning. Replacegeom_line(size = 2)withgeom_line(linewidth = 2).random_image()now acceptswidth = NULL,height = NULL,alt = NULLand includes them in the returned list when set. Default shape unchanged (justsrc), so existing callers are untouched.n_bars = NULLargument onrandom_ggplot(): when set together withtype = "bar", the function generates a synthetic categorical data frame so the rendered plot has exactly that many bars. Without the argument, the legacy datasets-based behaviour is kept.Test plan
testthat::test_local(): 3175 PASS / 0 FAIL.test-no_deprecated_args.R(ggplot_build underexpect_no_warning, plus static sweep onPlot.R)test-image_args.R(defaultsrc-only, all three extras propagated,NULLextras dropped)test-bar_n.R(1 / 3 / 7 / 27 bars match the rendered output, invalidn_barsrejected)Tracking notes in
dev/SUIVI_ISSUES.md.Closes #5
Closes #9
Closes #13