Skip to content

Look for NEWS files only where news() reads them - #276

Merged
LiNk-NY merged 2 commits into
develfrom
checknews-file-lookup
Dec 3, 2026
Merged

LiNk-NY merged 2 commits into
develfrom
checknews-file-lookup

Conversation

@LiNk-NY

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

Copy link
Copy Markdown
Contributor

Found in the review of #275.

checkNEWS() searched the whole package with list.files(pattern = "NEWS[\\.Rd|\\.md]*$", recursive = TRUE) and parsed head() of the result. That has three problems:

  • [\.Rd|\.md]* is a character class, not alternation. Any run of \ . R d | m after NEWS matches, so NEWS.Rmd counts as a NEWS file.
  • The pattern isn't anchored at the start, so oldNEWS or myNEWS match too.
  • The search is recursive, and the file parsed is the first one in locale sort order. With the files below, head() picked inst/NEWS, which news() reads last.

So a vignette or test fixture whose name ends in NEWS raised a spurious "More than one NEWS file found" NOTE. BiocCheck could also warn about a stray file while the real NEWS file was fine, or the reverse.

Changes

  • Check only inst/NEWS.Rd, NEWS.md, inst/NEWS.md, NEWS and inst/NEWS. That is the order in which news() looks for their installed copies (NEWS.Rd, NEWS.md, NEWS). Parse the first one found.
  • Name files by their path from the package root in the NOTE and WARNING.
  • Import utils::file_test.

Tests
A package with a valid NEWS plus vignettes/NEWS.Rmd, tests/fixtures/oldNEWS and inst/NEWS.txt raises no conditions. Adding an unparseable inst/NEWS.Rd gives one NOTE listing only inst/NEWS.Rd and NEWS, and one WARNING naming inst/NEWS.Rd. Against the old checkNEWS(), 5 of these assertions fail.

Checks

  • inst/tinytest/test_BiocCheck.R passes 175 of 175 on R-devel (2026-12-02 r91021) with Bioc 3.25, run twice in one R session.

🤖 Generated with Claude Code

LiNk-NY and others added 2 commits December 2, 2026 23:27
checkNEWS() searched the whole package with the pattern
'NEWS[\\.Rd|\\.md]*$'. The bracket is a character class, not
alternation, and nothing anchors the start of the name, so files such
as vignettes/NEWS.Rmd or tests/fixtures/oldNEWS matched. These raised
a spurious 'More than one NEWS file' NOTE. The file it then parsed was
the first in locale sort order, which need not be the one news() reads.

Check only inst/NEWS.Rd, NEWS.md, inst/NEWS.md, NEWS and inst/NEWS, in
the order news() looks for their installed copies (NEWS.Rd, NEWS.md,
NEWS), and parse the first one found.

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

claude Bot commented Dec 3, 2026

Copy link
Copy Markdown

I found nothing worth raising. The change fixes the old pattern and anchoring problems. The new tests cover the NEWS.Rmd, oldNEWS and inst/NEWS.txt cases. file_test is imported in both the roxygen tags and NAMESPACE. checkNEWS() is internal, so there is no exported-function documentation to update. The NEWS entry is included.

I read the diff and the surrounding code but did not run the tests.

@codecov

codecov Bot commented Dec 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.18%. Comparing base (56333c3) to head (b68f962).

Additional details and impacted files
@@            Coverage Diff             @@
##            devel     #276      +/-   ##
==========================================
- Coverage   70.21%   70.18%   -0.03%     
==========================================
  Files          15       15              
  Lines        2793     2791       -2     
==========================================
- Hits         1961     1959       -2     
  Misses        832      832              

☔ 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 8eb0471 into devel Dec 3, 2026
5 checks passed
@LiNk-NY
LiNk-NY deleted the checknews-file-lookup branch December 3, 2026 04:44
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