Skip to content

[Linting Rule] Namespace Tampering

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.

Namespace Tampering [overview]

smell cmd-check 37 robustness security

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 unlockBinding() and assignInNamespace() on other namespaces, .Internal() calls, and library.dynam() given a file extension.
This linting rule is implemented in src/linter/rules/cmd-check/namespace-tampering.ts.

Configuration

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

Examples

patch <- function() assignInNamespace("mean", function(x, ...) 42, "base")

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

[ { "type": "linter",   "rules": [ { "name": "namespace-tampering",     "config": {} } ] } ]

Results (prettified and summarized):

Query: linter (2 ms)
   ╰ Namespace Tampering (namespace-tampering):
       ╰ certain:
           ╰ assign-in-namespace of base at 1.21-74

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

Clone this wiki locally