Public-Health-Scotland / phsmethods

An R package to standardise methods used in Public Health Scotland (https://public-health-scotland.github.io/phsmethods/)
https://public-health-scotland.github.io/phsmethods/
54 stars 13 forks source link

fix #86 adding verbose inheritance checks #87

Closed JoKPro closed 1 year ago

JoKPro commented 1 year ago

Hi,

I wrote a function that checks for the inheritance, prints out each argument that is lacking one of the specified classes and throws an exception. This is aiming to solve the issue #86 .

I added a new file make_inheritance_checks.R that contains the function, together with some documentation. Hope this helps and let me know if there are any questions!

Moohan commented 1 year ago

I've just seen the tests and lots are failing now, this seems to be because dob_from_chi has NULL by default for min_date andmax_datebut your function is throwing an error when arguments areNULL`.

JoKPro commented 1 year ago

I implemented the cli messages and added an argument ignore_null that lets you decide whether or not to ignore if checked arguments are NULL. Hope this resolves the issue.

JoKPro commented 1 year ago

I see, thanks for the feedback!

JoKPro commented 1 year ago

I implemented the tasks you mentioned and made the tests pass, hope this works!