Skip to content

Commit b9794fa

Browse files
authored
Merge branch 'r-lib:main' into challenge-uncommited-tweaks
2 parents 386aec3 + 83a6b5f commit b9794fa

File tree

13 files changed

+78
-36
lines changed

13 files changed

+78
-36
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ on:
1212

1313
name: R-CMD-check
1414

15+
permissions: read-all
16+
1517
jobs:
1618
R-CMD-check:
1719
runs-on: ${{ matrix.config.os }}
@@ -25,17 +27,15 @@ jobs:
2527
- {os: macos-latest, r: 'release'}
2628

2729
- {os: windows-latest, r: 'release'}
28-
# Use 3.6 to trigger usage of RTools35
29-
- {os: windows-latest, r: '3.6'}
3030
# use 4.1 to check with rtools40's older compiler
3131
- {os: windows-latest, r: '4.1'}
3232

33-
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
34-
- {os: ubuntu-latest, r: 'release'}
35-
- {os: ubuntu-latest, r: 'oldrel-1'}
36-
- {os: ubuntu-latest, r: 'oldrel-2'}
37-
- {os: ubuntu-latest, r: 'oldrel-3'}
38-
- {os: ubuntu-latest, r: 'oldrel-4'}
33+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
34+
- {os: ubuntu-latest, r: 'release'}
35+
- {os: ubuntu-latest, r: 'oldrel-1'}
36+
- {os: ubuntu-latest, r: 'oldrel-2'}
37+
- {os: ubuntu-latest, r: 'oldrel-3'}
38+
- {os: ubuntu-latest, r: 'oldrel-4'}
3939

4040
env:
4141
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
@@ -54,7 +54,7 @@ jobs:
5454

5555
- uses: r-lib/actions/setup-r-dependencies@v2
5656
with:
57-
extra-packages: any::rcmdcheck, magick=?ignore-before-r=4.0.0
57+
extra-packages: any::rcmdcheck
5858
needs: check
5959

6060
- name: Configure Git User
@@ -64,8 +64,6 @@ jobs:
6464
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
6565
6666
- uses: r-lib/actions/check-r-package@v2
67-
env:
68-
_R_CALLS_INVALID_NUMERIC_VERSION_: true
69-
_R_CHECK_FORCE_SUGGESTS_: false
7067
with:
7168
upload-snapshots: true
69+
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

.github/workflows/pkgdown.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ on:
1111

1212
name: pkgdown
1313

14+
permissions: read-all
15+
1416
jobs:
1517
pkgdown:
1618
runs-on: ubuntu-latest

.github/workflows/pr-commands.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66

77
name: Commands
88

9+
permissions: read-all
10+
911
jobs:
1012
document:
1113
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }}

.github/workflows/test-coverage.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88

99
name: test-coverage
1010

11+
permissions: read-all
12+
1113
jobs:
1214
test-coverage:
1315
runs-on: ubuntu-latest
@@ -23,7 +25,7 @@ jobs:
2325

2426
- uses: r-lib/actions/setup-r-dependencies@v2
2527
with:
26-
extra-packages: any::covr
28+
extra-packages: any::covr, any::xml2
2729
needs: coverage
2830

2931
- name: git config
@@ -33,18 +35,27 @@ jobs:
3335
3436
- name: Test coverage
3537
run: |
36-
covr::codecov(
38+
cov <- covr::package_coverage(
3739
quiet = FALSE,
3840
clean = FALSE,
3941
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
4042
)
43+
covr::to_cobertura(cov)
4144
shell: Rscript {0}
4245

46+
- uses: codecov/codecov-action@v4
47+
with:
48+
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
49+
file: ./cobertura.xml
50+
plugin: noop
51+
disable_search: true
52+
token: ${{ secrets.CODECOV_TOKEN }}
53+
4354
- name: Show testthat output
4455
if: always()
4556
run: |
4657
## --------------------------------------------------------------------
47-
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
58+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
4859
shell: bash
4960

5061
- name: Upload test results

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ Description: Automate package and project setup tasks that are otherwise
1919
License: MIT + file LICENSE
2020
URL: https://usethis.r-lib.org, https://github.com/r-lib/usethis
2121
BugReports: https://github.com/r-lib/usethis/issues
22-
Depends:
22+
Depends:
2323
R (>= 3.6)
24-
Imports:
24+
Imports:
2525
cli (>= 3.0.1),
2626
clipr (>= 0.3.0),
2727
crayon,
@@ -43,7 +43,7 @@ Imports:
4343
whisker,
4444
withr (>= 2.3.0),
4545
yaml
46-
Suggests:
46+
Suggests:
4747
covr,
4848
knitr,
4949
magick,

R/logo.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020
use_logo <- function(img, geometry = "240x278", retina = TRUE) {
2121
check_is_package("use_logo()")
2222

23-
logo_path <- proj_path("man", "figures", "logo", ext = path_ext(img))
23+
ext <- tolower(path_ext(img))
24+
logo_path <- proj_path("man", "figures", "logo", ext = ext)
2425
create_directory(path_dir(logo_path))
2526
if (!can_overwrite(logo_path)) {
2627
return(invisible(FALSE))
2728
}
2829

29-
if (path_ext(img) == "svg") {
30+
if (ext == "svg") {
3031
logo_path <- path("man", "figures", "logo.svg")
3132
file_copy(img, proj_path(logo_path), overwrite = TRUE)
3233
ui_bullets(c("v" = "Copied {.path {pth(img)}} to {.path {logo_path}}."))

R/roxygen.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,10 @@ check_uses_roxygen <- function(whos_asking) {
128128
return(invisible())
129129
}
130130

131+
whos_asking_fn <- sub("()", "", whos_asking, fixed = TRUE)
131132
ui_abort(c(
132133
"Package {.pkg {project_name()}} does not use roxygen2.",
133-
"{.fun {whos_asking}} can not work without it.",
134+
"{.fun {whos_asking_fn}} can not work without it.",
134135
"You might just need to run {.run devtools::document()} once, then try again."
135136
))
136137
}

R/use_import_from.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,16 @@ check_has_package_doc <- function(whos_asking) {
5858
return(invisible(TRUE))
5959
}
6060

61+
whos_asking_fn <- sub("()", "", whos_asking, fixed = TRUE)
6162
msg <- c(
62-
"!" = "{.fun {whos_asking}} requires package-level documentation.",
63+
"!" = "{.fun {whos_asking_fn}} requires package-level documentation.",
6364
" " = "Would you like to add it now?"
6465
)
6566
if (is_interactive() && ui_yep(msg)) {
6667
use_package_doc()
6768
} else {
6869
ui_abort(c(
69-
"{.fun {whos_asking}} requires package-level documentation.",
70+
"{.fun {whos_asking_fn}} requires package-level documentation.",
7071
"You can add it by running {.run usethis::use_package_doc()}."
7172
))
7273
}

tests/testthat/_snaps/logo.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,13 @@
88
[ ] Add logo to 'README.md' with the following html:
99
# {TESTPKG} <img src="man/figures/logo.png" align="right" height="90" alt="" />
1010

11+
# use_logo() writes a file in lowercase and it knows that
12+
13+
Code
14+
use_logo("LoGo.PNG")
15+
Message
16+
v Creating 'man/figures/'.
17+
v Resized 'LoGo.PNG' to 240x278.
18+
[ ] Add logo to your README with the following html:
19+
# {TESTPKG} <img src="man/figures/logo.png" align="right" height="90" alt="" />
20+

tests/testthat/_snaps/tibble.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# use_tibble() Imports tibble
1+
# use_tibble() Imports tibble and imports tibble::tibble()
22

33
Code
44
use_tibble()

tests/testthat/_snaps/utils-ui.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@
143143
ui_code_snippet(
144144
"\n options(\n warnPartialMatchArgs = TRUE,\n warnPartialMatchDollar = TRUE,\n warnPartialMatchAttr = TRUE\n )")
145145
Message
146-
[36moptions[39m[33m([39m
147-
warnPartialMatchArgs = [34mTRUE[39m,
148-
warnPartialMatchDollar = [34mTRUE[39m,
149-
warnPartialMatchAttr = [34mTRUE[39m
146+
[1moptions[22m[33m([39m
147+
warnPartialMatchArgs = [35mTRUE[39m,
148+
warnPartialMatchDollar = [35mTRUE[39m,
149+
warnPartialMatchAttr = [35mTRUE[39m
150150
)
151151

152152
# ui_code_snippet() with vector input [plain]
@@ -167,10 +167,10 @@
167167
ui_code_snippet(c("options(", " warnPartialMatchArgs = TRUE,",
168168
" warnPartialMatchDollar = TRUE,", " warnPartialMatchAttr = TRUE", ")"))
169169
Message
170-
[36moptions[39m[33m([39m
171-
warnPartialMatchArgs = [34mTRUE[39m,
172-
warnPartialMatchDollar = [34mTRUE[39m,
173-
warnPartialMatchAttr = [34mTRUE[39m
170+
[1moptions[22m[33m([39m
171+
warnPartialMatchArgs = [35mTRUE[39m,
172+
warnPartialMatchDollar = [35mTRUE[39m,
173+
warnPartialMatchAttr = [35mTRUE[39m
174174
)
175175

176176
# ui_code_snippet() when language is not R [plain]
@@ -199,7 +199,7 @@
199199
Code
200200
ui_code_snippet("if (1) {true_val} else {false_val}")
201201
Message
202-
[31mif[39m [33m([39m[34m1[39m[33m)[39m [34mTRUE[39m [31melse[39m [33m'FALSE'[39m
202+
[33mif[39m [33m([39m[35m1[39m[33m)[39m [35mTRUE[39m [33melse[39m [36m'FALSE'[39m
203203

204204
# ui_code_snippet() can NOT interpolate [plain]
205205

@@ -217,11 +217,11 @@
217217
Code
218218
ui_code_snippet("foo <- function(x){x}", interpolate = FALSE)
219219
Message
220-
foo [32m<-[39m [31mfunction[39m[33m([39mx[33m)[39m[33m{[39mx[33m}[39m
220+
foo [33m<-[39m [33mfunction[39m[33m([39mx[33m)[39m[33m{[39mx[33m}[39m
221221
Code
222222
ui_code_snippet("foo <- function(x){{x}}", interpolate = TRUE)
223223
Message
224-
foo [32m<-[39m [31mfunction[39m[33m([39mx[33m)[39m[33m{[39mx[33m}[39m
224+
foo [33m<-[39m [33mfunction[39m[33m([39mx[33m)[39m[33m{[39mx[33m}[39m
225225

226226
# bulletize() works
227227

tests/testthat/test-logo.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,16 @@ test_that("use_logo() shows a clickable path with README", {
1717
withr::local_options(usethis.quiet = FALSE)
1818
expect_snapshot(use_logo("logo.png"), transform = scrub_testpkg)
1919
})
20+
21+
# https://github.com/r-lib/usethis/issues/1999
22+
test_that("use_logo() writes a file in lowercase and it knows that", {
23+
skip_if_not_installed("magick")
24+
skip_on_os("solaris")
25+
26+
create_local_package()
27+
img <- magick::image_write(magick::image_read("logo:"), "LoGo.PNG")
28+
29+
withr::local_options(list(usethis.quiet = FALSE))
30+
expect_snapshot(use_logo("LoGo.PNG"), transform = scrub_testpkg)
31+
expect_proj_file("man", "figures", "logo.png")
32+
})

tests/testthat/test-tibble.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ test_that("use_tibble() requires a package", {
33
expect_usethis_error(use_tibble(), "not an R package")
44
})
55

6-
test_that("use_tibble() Imports tibble", {
6+
test_that("use_tibble() Imports tibble and imports tibble::tibble()", {
77
create_local_package()
88

99
withr::local_options(list(usethis.quiet = FALSE))
@@ -18,4 +18,7 @@ test_that("use_tibble() Imports tibble", {
1818
)
1919

2020
expect_match(proj_desc()$get("Imports"), "tibble")
21+
22+
pkg_doc <- readLines(package_doc_path())
23+
expect_match(pkg_doc, "#' @importFrom tibble tibble", all = FALSE)
2124
})

0 commit comments

Comments
 (0)