fix: read NAMESPACE to check source-module exports#83
Merged
vandenman merged 3 commits intoJun 12, 2026
Merged
Conversation
getFromNamespace requires the package to be loaded, causing analysisOptions() to fail for test files that run before any runAnalysis() has loaded the package into R's namespace. Reading the NAMESPACE file directly is simpler, faster, and works without the package being installed or loaded. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates rFunctionExistsInModule() to determine whether a function is available in a (non-binary) module by inspecting the module’s NAMESPACE exports, removing the previous namespace lookup helper.
Changes:
- Removed
function_exists()helper that usedutils::getFromNamespace(). - Updated non-binary path in
rFunctionExistsInModule()to readNAMESPACEand detectexport(<funName>).
Comment on lines
+82
to
+83
| nsFile <- file.path(modulePath, "NAMESPACE") | ||
| return(any(grepl(paste0("^export\\(", funName, "\\)$"), readLines(nsFile, warn = FALSE)))) |
Comment on lines
+82
to
+83
| nsFile <- file.path(modulePath, "NAMESPACE") | ||
| return(any(grepl(paste0("^export\\(", funName, "\\)$"), readLines(nsFile, warn = FALSE)))) |
Handles export(foo, bar), whitespace, comments, and names with regex metacharacters correctly without any string escaping. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
vandenman
reviewed
Jun 12, 2026
vandenman
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#81 replaced R-file sourcing with getFromNamespace, which requires the package to already be loaded. Test files whose analysisOptions() call runs before any runAnalysis() has loaded the namespace therefore fail.
For instance, this one https://github.com/jasp-stats/jaspReliability/actions/runs/27349024804/job/80805431404
or https://github.com/jasp-stats/jaspFactor/actions/runs/27413322189/job/81019730649
Reading the NAMESPACE file directly is load-order-independent, simpler, and equally fast.