-
Notifications
You must be signed in to change notification settings - Fork 1
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
[LINT_BUG]: Error when searching for module which uses ../ #137
Comments
@tyner I have run into—what I thought—was a similar issue and decided do reproduce your issue. However, I couldn't quite do that. SetupI created the following structure:
I added
lintr::lint("directory/Foo.R", linters = box.linters::box_default_linters)
options(box.path = "directory")
box::use(./Foo[foo])
foo("hello") I am using R 4.2.2 and {box.linters} installed from source 7b25817 (the v0.10.2 tag is missing). OutcomeRunning CleanShot.2024-11-13.at.09.49.28.mp4I played with this a bit more to get a better understanding and I think this is the expected behavior. A Search Path section in
When to use
|
There is an issue about mixing Setup
#' @export
hello <- function() {
print("hello world!")
}
box::use(
./foo[hello]
)
hello()
lintr::lint("directory/main.R", linters = box.linters::box_default_linters)
options(box.path = getwd())
lintr::lint("directory/main.R", linters = box.linters::box_default_linters) Outcome
ReasonThe helper function for determining the "working directory of a module" uses the box.linters/R/box_module_usage_helper_functions.R Lines 186 to 194 in 27df08a
This is contradicting {box} docs I linked above.
I am not sure if this is what you, @tyner, have been getting at or if it's an entirely separate issue. |
Thank you @TymekDev, your analysis is spot on and I greatly appreciate it. Looking back, my initial post was flawed/ambiguous -- I didn't make it clear what the 'test directory' was, and was unaware that Also thank you for pointing out that |
box.linters version
0.10.2
Sample source code to lint
Somewhat similar to #110 but this time using ../
Create a file
Foo.R
containing:Then in the parent directory of the directory where
Foo.R
lives, create a fileBar.R
containing:(NB: I omitted # 'export directives above because those were not playing nice with Markdown).
then run the following to verify that the example is a valid setup from the perspective of
box
mechanics(it prints out
hello from baz
as a confirmation)Lint command used
I tried various strategies to get it to work, including setting
options(box.path)
as well as the working directory.Lint result
Error: Linter 'box_mod_fun_exists_linter' failed in /path/to/directory/Foo.R: unable to load module “../Bar”; not found
Expected result
Would be nice for it to find the module. Perhaps this is not supported, but I didn't see it mentioned in the documentation.
The text was updated successfully, but these errors were encountered: