Skip to content

[Linting Rule] Rd Files

github-actions[bot] edited this page Oct 27, 2026 · 1 revision

Generated from 'wiki-linter.ts' on 2026-10-25, 09:29:25 UTC (v2.16.6), do not edit directly.

Rd Files [overview]

cmd-check 45–47, 50–55, 88–92 robustness

This rule ports the following steps of R CMD check (see the conformance table for the legend):

# Step Coverage Note
45 Rd files (book) 🟩 \Sexpr macros are not evaluated
46 Rd metadata (book) 🟩⭐ ⭐ also Rd names that differ only by case
47 Rd cross-references (book) 🔷 targets in other packages are asked of the signature database
50 Rd \usage sections (book) 🟩
51 Rd contents (book) 🟩
52 Rd line widths (book) 🟩
53 examples (book) 🔷⭐ ⭐ also T and F in the examples
parses the examples and checks what they call, without running them
54 PDF version of manual (book) 🔷 the Rd constructs that break the LaTeX rendering
55 PDF version of manual without index (book) 🔷 the Rd constructs that break the LaTeX rendering
88 examples with --run-donttest (book) 🔷⭐ ⭐ also T and F in the examples
the \donttest code is checked like all examples
89 for non-standard things in the check directory (book) 🔷 files tests, vignettes, and examples write into the working directory
90 for detritus in the temp directory (book) 🔶 only the files written by name
91 for new files in some other directories (book) 🔶 only the files written by name
92 HTML version of manual (book) 🔷 the Rd files that would not render

This rule is a best-effort rule.

Finds problems in the Rd files: syntax, unknown macros, required and duplicated sections, metadata, cross-references, line widths, contents, and the example code.
This linting rule is implemented in src/linter/rules/cmd-check/rd-files.ts.

Configuration

Linting rules can be configured by passing a configuration object to the linter query as shown in the example below. The rd-files rule accepts the following configuration options:

  • bibentries
    report bibentries a page cites but does not show
    R CMD check #45
  • contents
    report missing descriptions and values, argument items without text, and generated boilerplate
    R CMD check #51
  • crossReferences
    report links to topics no page or package provides
    R CMD check #47
  • docStyle
    report S3 methods a \usage calls by their full name instead of with \method
    R CMD check #50
  • examples
    parse the examples and report their syntax errors, undefined calls, T and F, q(), and the files they write
    R CMD check #53, #88
  • examplesWidth
    the widest line an \examples section may have
    R CMD check #52
  • extraMacros
    Rd macro files to load besides those of the package
    R CMD check #45
  • keywords
    the keywords besides the standard ones a page may use
    R CMD check #45
  • lineWidths
    report lines in \usage and \examples wider than RdFilesConfig#usageWidth and RdFilesConfig#examplesWidth
    R CMD check #52
  • metadata
    report duplicate names and aliases, names that differ only by case, and pages without any alias
    R CMD check #46
  • minLevel
    drop parser diagnostics below this checkRd level, the messages of prepare_Rd are always kept
    R CMD check #45
  • parse
    report what the Rd parser of R reports: syntax errors, unknown macros, and unexpected sections
    R CMD check #45
  • requireValue
    report functions documented without a \value section
    R CMD check #51
  • standardKeywords
    report keywords that are neither standard nor in RdFilesConfig#keywords
    R CMD check #45
  • uncertainLinks
    also report links whose target flowR cannot decide
    R CMD check #47
  • usageWidth
    the widest line a \usage section may have
    R CMD check #52

Examples

A project with the code R/code.R:

f <- function(x) x

and the files

DESCRIPTION:

Package: pkg
Version: 1.0
Title: A Package
License: MIT

man/f.Rd:

\name{f}
\alias{f}
\title{F}
\description{D}
\details{
  a \foo{x}}

The linting query can be used to run this rule on the above example:

[ { "type": "linter",   "rules": [ { "name": "rd-files",     "config": {} } ] } ]

Results (prettified and summarized):

Query: linter (6 ms)
   ╰ Rd Files (rd-files):
       ╰ certain:
           ╰ rd-unknown-macro in man/f.Rd at /pkg/man/f.Rd:6.1

More examples are the test cases in test/functionality/linter/cmd-check/lint-rd-files.test.ts.

Clone this wiki locally