Skip to content

ci: Fail the roxygenize step on roxygen2 warnings - #111

Open
krlmlr wants to merge 1 commit into
mainfrom
claude/wizardly-gauss-fk5fxx
Open

ci: Fail the roxygenize step on roxygen2 warnings#111
krlmlr wants to merge 1 commit into
mainfrom
claude/wizardly-gauss-fk5fxx

Conversation

@krlmlr

@krlmlr krlmlr commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

roxygen2 has no strict mode to flip, so a warning about a malformed tag or an unresolvable link used to scroll by unnoticed in an otherwise green smoke test. The roxygenize action now collects the warnings emitted by the roxygen2::roxygenize() call and fails the step if there are any, following the approach proposed in igraph/rigraph#2868.

What the step does now:

  • Wraps roxygen2::roxygenize() in withCallingHandlers(), collecting each warning message and muffling it.
  • Prints the collected messages as a list, and emits one ::warning title=roxygen2:: annotation per message (escaped, since workflow commands are single-line) so they show up inline on the PR.
  • Calls stop() afterwards if the list is non-empty; otherwise reports that there were no warnings.

Collecting rather than options(warn = 2) is deliberate: converting warnings to errors would abort at the first one, before the documentation is written, and would also catch warnings unrelated to roxygenize(), such as warnings from loading the package. As written, roxygenize() still runs to completion, so the following commit step picks up the regenerated documentation, and only the step outcome changes. The step is already continue-on-error: true in R-CMD-check.yaml, so the remaining checks still run and the "Summarize checks" step reports Roxygenize as failed and fails the job.

Verified locally by extracting the step's script and running it both against a stub that warns (documentation still written, both messages printed and annotated, exit code 1, including a message with a % and an embedded newline) and against this package unchanged (no warnings, exit code 0).

🤖 Generated with Claude Code

https://claude.ai/code/session_01LhBJCM3pcSH6gJgTCngofP


Generated by Claude Code

roxygen2 has no strict mode,
so a warning about a malformed tag or an unresolvable link
used to scroll by unnoticed in a green smoke test.
Collect the warnings emitted by the `roxygen2::roxygenize()` call,
print them,
surface them as GitHub annotations,
and fail the step if there are any.

Collecting is deliberate,
`options(warn = 2)` would abort at the first warning,
before the documentation is written,
and would also catch warnings unrelated to `roxygenize()`.
This way the commit step still picks up the regenerated documentation,
and the smoke test summary reports the failure.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LhBJCM3pcSH6gJgTCngofP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants