Skip to content

[Linting Rule] Deprecated Functions

github-actions[bot] edited this page Nov 8, 2026 · 1 revision

Generated from 'wiki-linter.ts' on 2026-10-27, 10:46:55 UTC (v2.16.6), do not edit directly.

Deprecated Functions [overview]

smell quickfix deprecated reproducibility usability

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

# Step Coverage Note
37 R code for possible problems (book) 🟩⭐ ⭐ also quick fixes, deprecated arguments, environments resolved through variables, hooks followed into callees

This rule is a best-effort rule.

Finds deprecated functions and deprecated arguments of still-current functions, offering the replacement as a quick fix where one is known. A call to a bare name whose package the code never attaches is reported as uncertain, as any function of that name would answer to it.
This linting rule is implemented in src/linter/rules/deprecated-functions.ts.

Configuration

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

  • always
    Functions to always mark as deprecated
    R CMD check #37
  • conditionally
    Functions to mark as deprecated for specific argument, argument value or version. Keyed like DeprecatedFunctionsConfig.always : pkg::fn names the package the versions are checked against and matches only that one, a bare name matches any package.
    R CMD check #37

Examples

first <- data.frame(x = c(1, 2, 3), y = c(1, 2, 3))
second <- data.frame(x = c(1, 3, 2), y = c(1, 3, 2))
dplyr::all_equal(first, second)

library(ggplot2)
theme(panel.grid = element_line(size = 1))

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

[ { "type": "linter",   "rules": [ { "name": "deprecated-functions",     "config": {} } ] } ]

Results (prettified and summarized):

Query: linter (830 ms)
   ╰ Deprecated Functions (deprecated-functions):
       ╰ certain:
           ╰ function dplyr::all_equal at 4.1-31
           ╰ Argument size of function ggplot2::element_line at 7.33-36 (1 quick fix(es) available)

More examples are the test cases in test/functionality/linter/lint-deprecated-functions.test.ts.

Clone this wiki locally

⌂ 换网址