SBOHVM / RPiR

The Reproducible Programming in R course, developed by the School of Biodiversity, One Health and Veterinary Medicine at the University of Glasgow.
https://sbohvm.github.io/RPiR/
GNU General Public License v3.0
12 stars 2 forks source link

assert_no_globals #321

Closed soniamitchell closed 2 years ago

soniamitchell commented 3 years ago
richardreeve commented 3 years ago

name is the actual name of the function as a string. assert_no_globals() tries to infer that cleverly by deparsing the argument, but it doesn't always work (if you are passing a function through run_simulation() for instance), so you have to do it by hand. I'm happy to pass in a string if you know how to "call" a string, though then it would only work if the string was a function in the global namespace I guess?

soniamitchell commented 3 years ago

~> name is the actual name of the function as a string.~

~I realise that, but I don't understand why it's an argument since it's only used in the error message.~

I know how to call a function by its name, but before we do that, we should discuss https://github.com/IBAHCM/RPiR/projects/1#card-54492873

richardreeve commented 3 years ago

I realise you've deleted it, but the whole point of the function is to generate the error message, so that makes it useful. As far as the card above is concerned, we should turn it into an issue, because I can't comment on it, but for me (a) devtools::check() is terrifying! and (b) people do find global variables in their functions all the time. I wish there was something built-in we could use that was less scary...

soniamitchell commented 3 years ago

Yea, I didn't read this bit properly

but it doesn't always work (if you are passing a function through run_simulation() for instance), so you have to do it by hand

hence the deletion.

I thought we agreed to put suggestions on the project board as notes, rather than making them issues? – I can't remember why. I've converted the card to an issue.

richardreeve commented 3 years ago

We did just to get them up there quickly, but there's no reason not to convert them to issues.

soniamitchell commented 3 years ago

Yea, I converted them all into issues (and added a few more) a few days ago 👍

soniamitchell commented 2 years ago

expended documentation