Skip to content

Commit 5135402

Browse files
authored
Upkeep 2026-07 (#3008)
* Re-document * `use_tidy_description()` * `use_tidy_agents()` * `use_air()` * Reformat * `use_tidy_github_actions()` * Update snapshots. Random draws have changed because htmlwidgets no longer samples from global RNG stream. * Quiet test output
1 parent a6abe43 commit 5135402

39 files changed

Lines changed: 260 additions & 95 deletions

.Rbuildignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@
2525
^vignettes/articles/*_files$
2626
^vignettes/articles$
2727
^\.vscode$
28-
^[\.]?air\.toml$
2928
^\.git-blame-ignore-revs$
29+
^AGENTS\.md$
30+
^\.claude$
31+
^[.]?air[.]toml$

.claude/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
settings.local.json

.claude/CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@../AGENTS.md

.claude/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json.schemastore.org/claude-code-settings.json",
3+
"permissions": {
4+
"deny": [
5+
"Read(.Renviron)",
6+
"Read(.env)"
7+
]
8+
}
9+
}

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ jobs:
2424
matrix:
2525
config:
2626
- {os: macos-latest, r: 'release'}
27-
2827
- {os: windows-latest, r: 'release'}
29-
# use 4.0 or 4.1 to check with rtools40's older compiler
30-
- {os: windows-latest, r: 'oldrel-3'}
31-
3228
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
3329
- {os: ubuntu-latest, r: 'release'}
3430
- {os: ubuntu-latest, r: 'oldrel-1'}
@@ -41,28 +37,23 @@ jobs:
4137
R_KEEP_PKG_SOURCE: yes
4238

4339
steps:
44-
- uses: actions/checkout@v4
40+
- uses: actions/checkout@v6
4541

4642
- uses: r-lib/actions/setup-pandoc@v2
4743

4844
- uses: r-lib/actions/setup-tinytex@v2
49-
env:
50-
TINYTEX_INSTALLER: TinyTeX
5145

5246
- uses: r-lib/actions/setup-r@v2
5347
with:
5448
r-version: ${{ matrix.config.r }}
5549
http-user-agent: ${{ matrix.config.http-user-agent }}
56-
use-public-rspm: true
5750

5851
- uses: r-lib/actions/setup-r-dependencies@v2
5952
with:
6053
extra-packages: any::rcmdcheck
6154
needs: check
6255

6356
- uses: r-lib/actions/check-r-package@v2
64-
env:
65-
R_QUARTO_QUIET: false
6657
with:
6758
upload-snapshots: true
6859
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Workflow derived from https://github.com/posit-dev/setup-air/tree/main/examples
2+
3+
on:
4+
# Using `pull_request_target` over `pull_request` for elevated `GITHUB_TOKEN`
5+
# privileges, otherwise we can't set `pull-requests: write` when the pull
6+
# request comes from a fork, which is our main use case (external contributors).
7+
#
8+
# `pull_request_target` runs in the context of the target branch (`main`, usually),
9+
# rather than in the context of the pull request like `pull_request` does. Due
10+
# to this, we must explicitly checkout `ref: ${{ github.event.pull_request.head.sha }}`.
11+
# This is typically frowned upon by GitHub, as it exposes you to potentially running
12+
# untrusted code in a context where you have elevated privileges, but they explicitly
13+
# call out the use case of reformatting and committing back / commenting on the PR
14+
# as a situation that should be safe (because we aren't actually running the untrusted
15+
# code, we are just treating it as passive data).
16+
# https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
17+
pull_request_target:
18+
19+
name: format-suggest.yaml
20+
21+
jobs:
22+
format-suggest:
23+
name: format-suggest
24+
runs-on: ubuntu-latest
25+
26+
permissions:
27+
# Required to push suggestion comments to the PR
28+
pull-requests: write
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
with:
33+
ref: ${{ github.event.pull_request.head.sha }}
34+
35+
- name: Install
36+
uses: posit-dev/setup-air@v1
37+
38+
- name: Format
39+
run: air format .
40+
41+
- name: Suggest
42+
uses: reviewdog/action-suggester@v1
43+
with:
44+
level: error
45+
fail_level: error
46+
tool_name: air

.github/workflows/pkgdown.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ jobs:
2323
permissions:
2424
contents: write
2525
steps:
26-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@v6
2727

2828
- uses: r-lib/actions/setup-pandoc@v2
2929

3030
- uses: r-lib/actions/setup-r@v2
31-
with:
32-
use-public-rspm: true
3331

3432
- uses: r-lib/actions/setup-r-dependencies@v2
3533
with:
@@ -44,7 +42,7 @@ jobs:
4442

4543
- name: Deploy to GitHub pages 🚀
4644
if: github.event_name != 'pull_request'
47-
uses: JamesIves/github-pages-deploy-action@v4.5.0
45+
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
4846
with:
4947
clean: false
5048
branch: gh-pages

.github/workflows/test-coverage.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,19 @@ jobs:
1616
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1717

1818
steps:
19-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@v6
2020

2121
- uses: r-lib/actions/setup-pandoc@v2
2222

23+
- uses: r-lib/actions/setup-tinytex@v2
24+
2325
- uses: r-lib/actions/setup-r@v2
24-
with:
25-
use-public-rspm: true
2626

2727
- uses: r-lib/actions/setup-r-dependencies@v2
2828
with:
2929
extra-packages: any::covr, any::xml2
3030
needs: coverage
3131

32-
- uses: r-lib/actions/setup-tinytex@v2
33-
env:
34-
TINYTEX_INSTALLER: TinyTeX
35-
3632
- name: Test coverage
3733
run: |
3834
cov <- covr::package_coverage(
@@ -44,7 +40,7 @@ jobs:
4440
covr::to_cobertura(cov)
4541
shell: Rscript {0}
4642

47-
- uses: codecov/codecov-action@v5
43+
- uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
4844
with:
4945
# Fail if error if not on PR, or if on PR and token is given
5046
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
@@ -62,7 +58,7 @@ jobs:
6258

6359
- name: Upload test results
6460
if: failure()
65-
uses: actions/upload-artifact@v4
61+
uses: actions/upload-artifact@v7
6662
with:
6763
name: coverage-test-failures
6864
path: ${{ runner.temp }}/package

AGENTS.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
## This package
2+
3+
<!-- Insert package-specific content here. use_tidy_agents() will preserve this section when updating the rest of the file. -->
4+
5+
## Package development
6+
7+
### Key commands
8+
9+
(All these functions have been optimized for agentic use, so they can be called directly without other arguments.)
10+
11+
```R
12+
# Executing code
13+
devtools::load_all()
14+
code
15+
16+
# Tests
17+
devtools::test() # all tests
18+
devtools::test(filter = "^{name}") # tests for files starting with {name}
19+
devtools::test_active_file("R/{name}.R") # tests for R/{name}.R
20+
devtools::test_active_file("R/{name}.R", desc = 'blah') # single test with exact description "blah" (no regexp)
21+
22+
# Test coverage
23+
devtools::test_coverage() # all files
24+
devtools::test_coverage_active_file("R/{name}.R") # coverage for R/{name}.R from tests in tests/testthat/test-{name}.R
25+
26+
# Documentation
27+
devtools::document() # redocument package
28+
pkgdown::check_pkgdown() # check website
29+
30+
# Run complete R CMD check
31+
devtools::check()
32+
```
33+
34+
### Running R
35+
36+
There are three possible ways to run code, listed in rough order of desirability:
37+
38+
- If you're running inside Posit Assistant or otherwise have an
39+
`executeCode()` tool available, use it to run code in a session that the
40+
user can also interact with.
41+
42+
- Otherwise, if an R REPL (e.g. `mcp__r__repl` or `btw::run_r`) is
43+
available, use that. Note that `mcp__r__repl` uses a sandbox that blocks
44+
network requests and reads/writes outside of the current directory.
45+
46+
- Otherwise, use `Rscript -e "code"`.
47+
48+
### Code style
49+
50+
- Follow the tidyverse style guide
51+
- Always run `air format .` after generating code.
52+
- Use the base pipe operator (`|>`), not the magrittr pipe (`%>%`).
53+
- Use `\() ...` for single-line anonymous functions. For all other cases, use `function() {...}`.
54+
55+
### Test style
56+
57+
- Tests for `R/{name}.R` go in `tests/testthat/test-{name}.R`.
58+
- All new code should have an accompanying test.
59+
- If there are existing tests, place new tests next to similar existing tests.
60+
- Strive to keep your tests minimal with few comments.
61+
- Never put code in a `test-{name}.R` file outside of a `test_that()` block. Instead, use `tests/testthat/helper.R` or `tests/testthat/helper-{name}.R`.
62+
- Avoid `expect_true()` and `expect_false()` in favor of a specific expectation with a better failure message. A few expectations in newer releases that you might not know about are `expect_all_true()`, `expect_all_equal()`, and `expect_r6_class()`.
63+
- When testing errors and warnings:
64+
- Only use `expect_error()` or `expect_warning()` if the error or warning has a known class.
65+
- Generally, prefer `expect_snapshot(error = TRUE)` for errors and `expect_snapshot()` for warnings because these allow the user to review the full text of the output.
66+
- Avoid the `.package` argument to `local_mocked_bindings()`; this modifies the namespace of another package, which is not good practice. Instead create a mockable version of the function in the current package. See `?local_mocked_bindings` for more details.
67+
68+
### Documentation
69+
70+
- Every user-facing function should be exported and have roxygen2 documentation.
71+
- Internal functions should not have roxygen documentation.
72+
- Wrap roxygen2 comments to 80 characters.
73+
- Whenever you add a new (non-internal) documentation topic, also add the topic to `_pkgdown.yml`.
74+
- Always re-document the package after changing a roxygen2 comment.
75+
- Use `pkgdown::check_pkgdown()` to check that all topics are included in the reference index.
76+
77+
### `NEWS.md`
78+
79+
- Every user-facing change should be given a bullet in `NEWS.md`.
80+
- Changes that shouldn't get a bullet:
81+
- Small documentation changes.
82+
- Internal refactorings.
83+
- Fixes to bugs introduced in the current dev version.
84+
- Each bullet should briefly describe the change to the end user and mention the related issue in parentheses.
85+
- A bullet can consist of multiple sentences but should not contain any newlines (i.e. DO NOT line wrap).
86+
- If the change is related to a function, put the name of the function early in the bullet.
87+
- If the change is related to an issue, include the issue number in parentheses.
88+
- Only include a GitHub username if the PR was created by someone who isn't an author.
89+
- Order bullets alphabetically by function name. Put all bullets that don't mention function names at the beginning.
90+
91+
## Specialized skills
92+
93+
- Do you need to deprecate a function or argument? Read the output of `usethis::learn_tidy_skill("deprecate")`.
94+
- Are you adding input checking to an existing function or writing a new exported function? Read the output of `usethis::learn_tidy_skill("arg-checking")`.
95+
96+
## Git
97+
98+
- If the user asks you to commit, use markdown in the commit message, and don't line wrap.
99+
- If the commit fixes an issue, include `Fixes #num.` on its own line.
100+
- Only push when the user explicitly requests it.
101+
102+
## Writing
103+
104+
- Use sentence case for headings.
105+
- Use US English.
106+
107+
### Proofreading
108+
109+
If the user asks you to proofread a file, act as an expert proofreader and editor with a deep understanding of clear, engaging, and well-structured writing.
110+
111+
Work paragraph by paragraph, always starting by making a TODO list that includes individual items for each top-level section.
112+
113+
Fix spelling, grammar, and other minor problems without asking the user. Label any unclear, confusing, or ambiguous sentences with a FIXME comment.
114+
115+
Only report what you have changed.

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ Imports:
3434
httr2 (>= 1.0.2),
3535
jsonlite,
3636
lifecycle,
37-
openssl,
3837
nanonext (>= 1.8.0),
38+
openssl,
3939
purrr (>= 1.0.0),
4040
ragg (>= 1.4.0),
4141
rlang (>= 1.1.4),
@@ -69,12 +69,12 @@ VignetteBuilder:
6969
quarto
7070
Config/Needs/website: usethis, servr
7171
Config/potools/style: explicit
72+
Config/roxygen2/version: 8.0.0
7273
Config/testthat/edition: 3
7374
Config/testthat/parallel: true
7475
Config/testthat/start-first: build-article, build-quarto-article,
7576
build-reference, build
7677
Config/usethis/last-upkeep: 2025-09-07
7778
Encoding: UTF-8
7879
Roxygen: list(markdown = TRUE)
79-
RoxygenNote: 7.3.3
8080
SystemRequirements: pandoc (>= 2.10.1)

0 commit comments

Comments
 (0)