Skip to content

[Linting Rule] Package Runtime

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

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

Package Runtime [overview]

bug cmd-check 4–5, 7, 33, 77, 79–81, 83–87, 89–91 robustness

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

# Step Coverage Note
4 if this is a source package (book) 🟩 the Built field and object files in src are not checked
5 extension type (book) 🟩
7 if there is a namespace (book) 🟩 needs the package on disk
33 whether the namespace can be loaded with stated dependencies (book) 🔷
77 whether package can be installed (book) 🔷⭐ ⭐ also compiled code never loaded for lack of useDynLib
useDynLib and src/ in agreement, headers from LinkingTo, undefined exports
79 Rust compilation (book) 🔷 Rust sources need Cargo and rustc in SystemRequirements
80 whether the package can be loaded (book) 🔷 S3 methods registered without a function, imports of unexported names
81 loading without being on the library search path (book) 🔷 the package attaching itself
83 tests (book) 🔷⭐ ⭐ also testthat tests without a runner, runners testing another package
tests are not run, only checked for runners and syntax
84 for differences from example reference output (book) 🔷⭐ ⭐ also reference output without its test
example output is not compared with its reference
85 running R code from vignettes (book) 🔷 vignette code that does not parse
86 re-building of vignette outputs (book) 🔷 vignettes without index entry or engine
87 package vignettes (book) 🔷 non-ASCII vignettes without declared encoding are not reported
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

This rule is a best-effort rule.

Finds what makes installing, loading, or running the package fail without doing so: undefined exports, S3 methods without a function, bad NAMESPACE imports, a package attaching itself, tests that never run, test or vignette code that does not parse, missing vignette metadata, and files written into the working directory.
This linting rule is implemented in src/linter/rules/cmd-check/package-runtime.ts.

Configuration

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

  • checkWrites
    report writes of tests and vignettes into the working directory (default true)
    R CMD check #89

Examples

A project with the code R/code.R:

f <- function() 1

and the files

DESCRIPTION:

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

NAMESPACE:

export(f)
export(g)

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

[ { "type": "linter",   "rules": [ { "name": "package-runtime",     "config": {} } ] } ]

Results (prettified and summarized):

Query: linter (2 ms)
   ╰ Package Runtime (package-runtime):
       ╰ certain:
           ╰ undefined-export at /pkg/NAMESPACE:2.1

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

Clone this wiki locally