foreach icon indicating copy to clipboard operation
foreach copied to clipboard

params of unregister foreach, where they are in the env? (linting)

Open latot opened this issue 1 year ago • 0 comments

Hi hi, I'm working in a project, where is registered foreach, and then on exit unregistered:

  old_do_par <- doFuture::registerDoFuture()
  on.exit(
    with(
        old_do_par,
        foreach::setDoPar(fun = fun, data = data, info = info)
    ),
    add = TRUE
  )

Probable this code comes from: https://www.rdocumentation.org/packages/doFuture/versions/0.12.2/topics/registerDoFuture

And when we run linting we get:

lintr::lint_package(".")
file.R:124:58: warning: [object_usage_linter] no visible binding for global variable ‘info’
        foreach::setDoPar(fun = fun, data = data, info = info)

The point is clear, even with that definition, the fun, data and info are not declared everywhere, this vars belongs to the package foreach? or from where?

Thx!.

latot avatar Aug 02 '22 17:08 latot