Skip to content

Check duplicate chunk labels only in knitr-tangled vignettes - #272

Merged
LiNk-NY merged 2 commits into
develfrom
vignette-dup-labels-sweave
Dec 2, 2026
Merged

LiNk-NY merged 2 commits into
develfrom
vignette-dup-labels-sweave

Conversation

@LiNk-NY

@LiNk-NY LiNk-NY commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

BiocCheck halts at "Checking vignette directory" on Sweave vignettes whose chunk options knitr can't parse, as seen in the r-universe Bioc builds for CNORfuzzy, flowBeads, isobar, mirIntegrator, riboSeqR, and xmapbridge:

* Checking vignette directory...
Error : ! in callr subprocess.
Caused by error in `parse(text = code, keep.source = FALSE)`:
! <text>:1:8: unexpected '<'
1: alist( <

Cause
checkDupChunkLabels() runs knitr::purl() on every vignette, but BiocCheck tangles .Rnw files without a knitr or quarto VignetteEngine with Stangle() everywhere else. These vignettes declare no engine and use chunk headers Sweave accepts but knitr rejects (<<<eval=F>>=, <<defaultParameters echo=TRUE>>=). Errors other than "Duplicate chunk label" are re-signalled with warning(e), which an enclosing tryCatch(error = ) still treats as an error, so BiocCheck stops.

Change

  • Move the knitr-or-Sweave choice in purl_or_tangle() into .isKnitrTangled().
  • checkDupChunkLabels() checks only vignettes for which .isKnitrTangled() is TRUE: Rmd and qmd vignettes, and Rnw vignettes that declare a knitr or quarto VignetteEngine. Rnw vignettes tangled with Sweave are skipped. Sweave allows duplicate labels: R CMD build and R CMD check pass with them, though two fig=TRUE chunks sharing a label write the same figure file, so the later plot replaces the earlier one.

Checks

  • Added tests to inst/tinytest/test_checkVignettes.R: a Sweave vignette with <<<eval=F>>= and duplicate labels gives no condition, and a .Rnw that declares knitr::knitr with duplicate labels is still flagged.
  • Ran checkVignetteDir() on the nine vignettes of the six packages above: before the change all six packages halt with ! in callr subprocess; after it all six complete. Stangle() tangles every one of them.
  • On R-devel with Bioc 3.25, test_BiocCheck.R passes 146 of 146 and test_checkVignettes.R passes 28 of 28. R CMD check is left to CI.
  • Updated NEWS. No vignette change is needed.

This PR was drafted with the help of Claude Code (Claude Opus 5.5).

🤖 Generated with Claude Code

LiNk-NY and others added 2 commits December 2, 2026 12:32
checkDupChunkLabels() ran knitr::purl() on every vignette, including
Sweave .Rnw files that BiocCheck otherwise tangles with Stangle().
knitr cannot parse some Sweave chunk options (e.g., `<<<eval=F>>=`),
and the re-signalled error halted BiocCheck with "! in callr
subprocess". Sweave allows duplicate labels, so the check only applies
to vignettes tangled with knitr. Factor the knitr-vs-Sweave decision
out of purl_or_tangle() into .isKnitrTangled() and use it in both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Dec 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.19%. Comparing base (a4a658c) to head (7e7dead).

Additional details and impacted files
@@            Coverage Diff             @@
##            devel     #272      +/-   ##
==========================================
+ Coverage   70.18%   70.19%   +0.01%     
==========================================
  Files          15       15              
  Lines        2767     2768       +1     
==========================================
+ Hits         1942     1943       +1     
  Misses        825      825              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LiNk-NY
LiNk-NY merged commit 0d5839b into devel Dec 2, 2026
5 checks passed
@LiNk-NY
LiNk-NY deleted the vignette-dup-labels-sweave branch December 2, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant