Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

object_usage_linter() should skip objects transitively attached by Depends #2695

Open
MichaelChirico opened this issue Dec 6, 2024 · 2 comments

Comments

@MichaelChirico
Copy link
Collaborator

library(bit64) # NB: as of now, bit64 Depends on bit, but that will likely change in the future

foo <- function(x) {
  bit()
}

Linting this will lint on bit:

warning: [object_usage_linter] no visible global function definition for 'bit'
  bit()
  ^~~

But because library(bit64) necessarily attaches {bit}, I think it shouldn't.

@MichaelChirico
Copy link
Collaborator Author

MichaelChirico commented Dec 6, 2024

A note for testing: as of today, {jsonlite} Depends on {methods}, so possibly we could test this in a sub-process where {methods} is not attached. None of our other direct dependencies use Depends at all.

Otherwise, we'd want to add a Suggests dependency on {bit64}.

@MichaelChirico
Copy link
Collaborator Author

Elsewhere I've seen as.environment("package:bit64")$.Depends used to get package dependencies, but this environment is only populated if {bit64} is attached. Here again #912 would help. Barring that, we can do what attachNamespace() does, which is to get Depends from DESCRIPTION.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant