Skip to content

[Feature Request]: Improve reporting of qenv code #305

Open

Description

@llrs-roche

Feature description

During #303 for #272 it was suggested to use globals package for finding issues with the code supplied.

Using code like this:

g2 <- globals::globalsOf(parsed_code, method = "conservative", mustExist = FALSE, envir = object@.xData)
    missing <- globals::cleanup(g2, drop = c("nativesymbolinfo", "base-packages"))
    if (length(missing)) {
      warn <- warningCondition(
        message = sprintf(
          "When evaluating qenv code:\n%s\nMissing objects %s",
          parsed_code,
          toString(sQuote(names(missing), "'"))
        ),
        class = c("qenv.warn", "simpleWarning")
      )
      warning(warn, call. = FALSE)
    }

Lead to warnings like this on tests:

When evaluating qenv code:
i <- subset(iris, Species == species)
Missing objects 'Species', 'species'

There wasn't an optimal method that would find those variables that cannot be created. It would be great if there were a better way to find the missing variables or external dependencies than to evaluate the code with the .GlobalEnv as this provides access to objects from packages that are not loaded inside the qenv.

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions