Open caldwellst opened 2 months ago
Have solved the vast majority of issues. I can successfully lint on my machine, yet the linting is failing on remote. See the latest failure here:
https://github.com/OCHA-DAP/hdx-signals/actions/runs/9746045472
ERROR [2024-07-01 14:28:10] Environment variable 'DSCI_AZ_SAS_PROD' is empty or not set.
Error: Error: Linter 'box_unused_attached_mod_linter' failed in /home/runner/work/hdx-signals/hdx-signals/src-static/update_acled_info.R:
Execution halted
Error: Process completed with exit code 1.
So, the failure is on the first script: 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
. Inside that module, it uses get_env$get_env()
: https://github.com/OCHA-DAP/hdx-signals/blob/736e8c71c9bd31d441308b11ee1d64f533f15870/src/utils/cloud_storage.R#L208
get_env()
retrieves an environment variable, but throws an error if it doesn't exist. This is the error we see in the lint run. https://github.com/OCHA-DAP/hdx-signals/blob/feature/box-lint/src/utils/get_env.R
However, when using the default linters in lintr
, we were receiving no such errors. I can remove environment variables from my machine and recreate the error locally, so it is not solely present on remote runs.
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, which leads me to believe there is something particularly unique going in this complex series of calls that is generating the error.
Was made aware of a package extension to
{lintr}
to lint box modules, {box.linters}. Should definitely explore usage, as out of the box should fix things like us having to disable theOBJECT_USAGE_LINTER
in{lintr}
, which means we aren't catching extraneous or missing imports, failing to catchlibrary::function()
calls, etc.