ci: Fail the roxygenize step on roxygen2 warnings - #111
Open
krlmlr wants to merge 1 commit into
Open
Conversation
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
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.
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
roxygenizeaction now collects the warnings emitted by theroxygen2::roxygenize()call and fails the step if there are any, following the approach proposed in igraph/rigraph#2868.What the step does now:
roxygen2::roxygenize()inwithCallingHandlers(), collecting each warning message and muffling it.::warning title=roxygen2::annotation per message (escaped, since workflow commands are single-line) so they show up inline on the PR.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 toroxygenize(), 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 alreadycontinue-on-error: trueinR-CMD-check.yaml, so the remaining checks still run and the "Summarize checks" step reportsRoxygenizeas 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