Skip to content

[Linting Rule] Undefined Symbol

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.

Undefined Symbol [overview]

bug experimental

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 over-approximative rule.

Finds functions and variables that are neither defined locally, a base R builtin, nor exported by a loaded package.
This linting rule is implemented in src/linter/rules/undefined-symbol.ts.

Configuration

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

  • checkFunctions
    flag names used in a function-call position that cannot be resolved (default true)
    R CMD check #37
  • checkSubscripts
    flag unresolved symbols used as [/[[ subscripts (default false). Off by default to mute data.table's DT[i, j, by] column masking, which flowR cannot distinguish from ordinary indexing.
    R CMD check #37
  • checkVariables
    flag names used as a variable read that cannot be resolved (default true). Formulas and data-masking (dplyr/tidyr/ggplot, subset/with) are recognised via flowR's dataflow, so this is precise; residual false positives are possible in dynamic eval/attach.
    R CMD check #37

Examples

undefined_helper(42)

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

[ { "type": "linter",   "rules": [ { "name": "undefined-symbol",     "config": {} } ] } ]

Results (prettified and summarized):

Query: linter (10 ms)
   ╰ Undefined Symbol (undefined-symbol):
       ╰ uncertain:
           ╰ Undefined function undefined_helper at 1.1-20

More examples are the test cases in test/functionality/linter/lint-undefined-symbol.test.ts.

Clone this wiki locally

⌂ 换网址