Repository navigation
[Linting Rule] Dependency Declaration
Generated from 'wiki-linter.ts' on 2026-10-25, 09:29:25 UTC (v2.16.6), do not edit directly.
Dependency Declaration [overview]
This rule ports the following steps of R CMD check (see the conformance table for the legend):
| # | Step | Coverage | Note |
|---|---|---|---|
| 27 | package dependencies (book) | 🔷 | availability and versions asked of the signature database instead of the repositories |
| 28 | dependencies in R code (book) | 🟩⭐ | ⭐ also resolves package names through variables and knows the loaders of other packages |
| 29 | for unstated dependencies in tests (book) | 🟩 | |
| 30 | for unstated dependencies in examples (book) | 🟩 | |
| 31 | for unstated dependencies in vignettes (book) | 🟩⭐ | ⭐ also packages named in \VignetteEngine |
| 32 | whether the package can be loaded with stated dependencies (book) | 🔷 | |
| 33 | whether the namespace can be loaded with stated dependencies (book) | 🔷 | |
| 53 | examples (book) | 🔷⭐ | ⭐ also T and F in the examples parses the examples and checks what they call, without running them |
| 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 |
| 83 | tests (book) | 🔷⭐ | ⭐ also testthat tests without a runner, runners testing another package tests are not run, only checked for runners and syntax |
| 85 | running R code from vignettes (book) | 🔷 | vignette code that does not parse |
| 88 | examples with --run-donttest (book) | 🔷⭐ | ⭐ also T and F in the examples the \donttest code is checked like all examples |
This rule is a best-effort rule.
Finds packages the code, tests, examples, or vignettes use without the DESCRIPTION declaring them, Imports nothing imports from, library() calls in package code, own ::: calls, and undeclared VignetteBuilder or RdMacros packages. Package names are resolved through variables.
This linting rule is implemented in src/linter/rules/cmd-check/dependency-declaration.ts.
Linting rules can be configured by passing a configuration object to the linter query as shown in the example below.
The dependency-declaration rule accepts the following configuration options:
-
checkAvailability
report declared packages the signature database does not know or cannot satisfy, whichR CMD checkasks the repositories about (defaulttrue)
R CMD check #27 -
checkOtherCode
check the packages the tests, vignettes, and examples use (defaulttrue)
R CMD check #29, #30, #31 -
headerOnlyPackages
packages that only provide C/C++ headers and hence belong into LinkingTo, a noteR CMD checkgives for CRAN submissions (defaultBH,RcppArmadillo,RcppEigen)
R CMD check #27 -
ignoreWithin
functions whose arguments run elsewhere, so the packages loaded there are no dependency of the package (defaultclusterEvalQ)
R CMD check #28 -
reportDependsNotImported
report packages in Depends the NAMESPACE imports nothing from, a noteR CMD checkonly gives for CRAN submissions (defaultfalse)
R CMD check #28 -
reportLibraryCalls
report everylibrary/requirecall in package code, even for declared packages (defaulttrue, asR CMD check)
R CMD check #28
A project with the code R/code.R:
f <- function(df) {
library(dplyr)
tidyr::drop_na(df)
}and the files
DESCRIPTION:
Package: pkg
Version: 1.0
Title: A Package
License: MIT
The linting query can be used to run this rule on the above example:
[ { "type": "linter", "rules": [ { "name": "dependency-declaration", "config": {} } ] } ]Results (prettified and summarized):
Query: linter (8 ms)
╰ Dependency Declaration (dependency-declaration):
╰ certain:
╰ undeclared-attach of dplyr at /pkg/R/code.R:2.2-15
╰ library-in-package of dplyr at /pkg/R/code.R:2.2-15
╰ undeclared-namespace of tidyr at /pkg/R/code.R:3.2-19
More examples are the test cases in test/functionality/linter/cmd-check/lint-dependency-declaration.test.ts.
Currently maintained by Florian Sihler and Oliver Gerstl at Ulm University
Email | GitHub | Penguins | Portfolio
- 🧑💻 Developer Onboarding
- 💻 Setup
- 👓 Overview
- 🪟 Interfacing with flowR
- 🌋 Core
- 🧹 Testing & Linting (Benchmark Page)
⁉️ FAQ- ℹ️ Extra Information