rstudio / rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more
http://rstudio.github.io/rsconnect/
133 stars 81 forks source link

Lint calls to .libPaths #256

Open aronatkins opened 6 years ago

aronatkins commented 6 years ago

Deployed content is usually executed in an environment that attempts to recreate the deploying user's configuration of packages/versions/R.

Modifying .libPaths() from within a Shiny application, R Markdown document, or Plumber API is likely to use paths that are not meaningful on the server.

Warn users about this likely problem.

hadley commented 1 year ago

Only need to warn if first argument (new) is not missing. Something like this:

trace(.libPaths, print = FALSE, quote({
  if (!missing(new)) {
    rlang::warn("Not a good idea on rsconnect")
  }
}))
.libPaths()
.libPaths(getwd())
hadley commented 1 year ago

Open question: should it warn or error?

aronatkins commented 1 year ago

Error feels too strong, or if it is an error, it needs to be suppressible. Folks might have some /mnt/share/R library that they conditionally add to the library path. It's not a recommended pattern, but it happens.

We might want to reiterate the same warning when running the content (this would be a Connect change).