-
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]: missing environment variable creates error in box_unused_attached_mod_linter
#113
Comments
At first inspection, this might be related to #110 box::use(../src/utils/location_codes)
box::use(cs = ../src/utils/cloud_storage)
box::use(../src/utils/hs_logger) We'll take a look. |
It might be, but this is occurring only in the |
@caldwellst , we hope you don't mind. We cloned your repo and tested with the Thanks for your valuable input! |
Absolutely don't mind and thanks for the support. Really excited to get using your package as it's clearly a missing piece of the |
box.linters version
0.9.1
Sample source code to lint
I am unable to create a simple reprex of this issue. However you can see the failure in this run. The eventual source of the error (connected through multiple
box::use()
calls, is this function here:Lint command used
Lint result
The lint fails when traversing functions that check the existence of environment variables. The first script, the one the error is generated at, is here: https://github.com/OCHA-DAP/hdx-signals/blob/feature/box-lint/src-static/update_acled_info.R
This script imports a module
cs = src/utils/cloud_storage
. https://github.com/OCHA-DAP/hdx-signals/blob/736e8c71c9bd31d441308b11ee1d64f533f15870/src/utils/cloud_storage.R#L208Inside that module, it uses get_env$get_env(), which returns an env var but throws an error if it doesn't exist. https://github.com/OCHA-DAP/hdx-signals/blob/feature/box-lint/src/utils/get_env.R.
This is the error we receive in the lint run. I can remove environment variables from my machine and recreate the error locally, so it is not solely present on remote runs. If I delete the file that it is first detected in, any file that imports
cs = src/utils/cloud_storage
(and thus usesget_env()
) also throws up the error if the env variables are not present.Expected result
When using the default linters in
{lintr}
, we were receiving no such errors.I have tried to create various minimal file directories and files to test linting and create an issue on the box.linters repo. However, I cannot reproduce the error with any simple code examples. I have tried multiple nested imports, the use of
switch()
, hardcoding or not the env variable check. None of these recreate the error, which leads me to believe there is something particularly unique going in this complex series of calls that is generating the error.Happy to help debug this and apologies I couldn't create this issue with a better reprex. Hoping you might already have an inkling of what is driving this, or a potential set of things to try and explore.
The text was updated successfully, but these errors were encountered: