You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#547 implements a missing_package_linter() which checks if all packages loaded by library(), require(), loadNamespace(), and requireNamespace() are installed.
Apart from that, we could also check the usage of ns::obj and ns:::obj as they also used to access objects in a namespace (provided by package).
We could implement a separate linter (as suggested at #547 (comment)) to check if
The package ns in ns::obj and ns:::obj are installed.
The obj in ns::obj is exported from namespace ns.
The obj in ns:::obj exists in namespace ns.
While checking 1 does not load any new package, checking 2 and 3 might load the package being checked. I'm not sure if we allow loading extra packages from user code?
Activity
AshesITR commentedon Oct 31, 2020
We already run user code for some linters:
https://github.com/jimhester/lintr/blob/1a618f3f7df4889fe39eff5e0ce4e5c0fc6eadfd/R/object_usage_linter.R#L1-L4
Maybe make these checks optional with a parameter and document that it may load packages if the parameter (
check_exports = TRUE?) is set?