-
Notifications
You must be signed in to change notification settings - Fork 195
Description
Description
object_usage_linter() reports no visible global function definition warnings for functions that are imported via the package NAMESPACE (e.g. importFrom() / import()). Those functions are actually available at runtime, so these warnings are false positives for package code.
Reproducible example
In NAMESPACE
importFrom(dplyr,mutate)
In R/file.R
mutate(data, x = x + 1)
leads to:
file.R:1:1: warning: no visible global function definition for 'mutate'
No warning should be emitted because mutate() is imported via NAMESPACE and therefore available to the package code.
Proposed Solution
When running the object_usage_linter in a package project, it should parse the NAMESPACE file for imports and collect all imports from importFrom. This avoids noisy false positives for properly authored packages and makes lintr behave consistently with R CMD check.
Notes:
I am not sure how to handle general package import() in NAMESPACE as the whole package needs to be checked which functions are exported.