metrumresearchgroup / mrgvalidate

R package for generating validation documents for other R packages developed by Metrum
https://metrumresearchgroup.github.io/mrgvalidate/
Other
1 stars 1 forks source link

Unhelpful error when test files are missing from `auto_test_dir` #76

Closed seth127 closed 2 years ago

seth127 commented 2 years ago

This was reported by @mgboyd1024 when trying to run create_validation_docs() and accidentally passing an empty directory to the auto_test_dir argument:

image (3)

We should probably do better than Error: .x is empty... in that situation.

In reality, all the _dir arguments should probably get checked and the user informatively warned (or maybe an actual error?) if they pass an empty directory to one of those arguments. Or probably even if they pass a directory that has none of the kinds of files we're looking for (which is different depending on which _dir argument we're talking about).

kyleam commented 2 years ago

accidentally passing an empty directory to the auto_test_dir argument

Odd. Haven't tried myself yet, but I would have expected an empty directory to hit into this error:

https://github.com/metrumresearchgroup/mrgvalidate/blob/0d22a0ce7889481c5a8698c53a1bd36f3d84c78f/R/read-results.R#L14-L20

the user informatively warned (or maybe an actual error?) [...] Or probably even if they pass a directory that has none of the kinds of files we're looking for

Aborting in these cases sounds like the way to go to me (and is line with already existing errors like the one above and elsewhere).

kyleam commented 2 years ago

Perhaps this was with an older version?

v1.0.1 included 0353932 (fix: read_csv_test_results: give informative "no CSVs found" error, 2021-08-17) and the error reported here matches the one I described in the commit message:

fix: read_csv_test_results: give informative "no CSVs found" error

If read_csv_test_results() is passed a directory that doesn't have any
CSV files, it fails with an unhelpful

   `.x` is empty, and no `.init` supplied

Provide a better error message.
seth127 commented 2 years ago

ahhhhh, that's probably right. @mgboyd1024 can you confirm what version of mrgvalidate you were using? Run packageVersion("mrgvalidate") from within that R session. Thanks.

mgboyd1024 commented 2 years ago

Hey guys, The mrgvalidate package version is 1.0.0

image

kyleam commented 2 years ago

Thanks @mgboyd1024. So indeed it looks like you were running on a version without the above fix. man_test_dir has a similar check (added in the same pr, gh-64), so I think we should be covered.

@seth127, I'll close this, but please reopen if you think there's anything else to look into or do.